[8/15] orinoco merge preliminaries - use BUG_ON()

From: David Gibson (hermes_at_gibson.dropbear.id.au)
Date: 07/28/04

  • Next message: David Gibson: "[9/15] orinoco merge preliminaries - make things static"
    Date:	Wed, 28 Jul 2004 16:57:25 +1000
    To: Jeff Garzik <jgarzik@pobox.com>, Francois Romieu <romieu@fr.zoreil.com>, Linux kernel mailing list <linux-kernel@vger.kernel.org>, jt@hpl.hp.com, Dan Williams <dcbw@redhat.com>, Pavel Roskin <proski@gnu.org>, Orinoco Development List <orinoco-devel@lists.sourceforge.net>
    
    

    Use BUG_ON() macro instead of explicit if(x) BUG() in various places.

    Signed-off-by: David Gibson <hermes@gibson.dropbear.id.au>

    Index: working-2.6/drivers/net/wireless/orinoco.c
    ===================================================================
    --- working-2.6.orig/drivers/net/wireless/orinoco.c 2004-07-28 15:05:39.583628208 +1000
    +++ working-2.6/drivers/net/wireless/orinoco.c 2004-07-28 15:05:40.433499008 +1000
    @@ -1770,11 +1770,10 @@
                     int i;
     
                     for (i = 0; i < mc_count; i++) {
    - /* Paranoia: */
    - if (! p)
    - BUG(); /* Multicast list shorter than mc_count */
    - if (p->dmi_addrlen != ETH_ALEN)
    - BUG(); /* Bad address size in multicast list */
    + /* paranoia: is list shorter than mc_count? */
    + BUG_ON(! p);
    + /* paranoia: bad address size in list? */
    + BUG_ON(p->dmi_addrlen != ETH_ALEN);
                             
                             memcpy(mclist.addr[i], p->dmi_addr, ETH_ALEN);
                             p = p->next;
    @@ -3185,8 +3184,7 @@
     
             ratemode = priv->bitratemode;
     
    - if ( (ratemode < 0) || (ratemode >= BITRATE_TABLE_SIZE) )
    - BUG();
    + BUG_ON((ratemode < 0) || (ratemode >= BITRATE_TABLE_SIZE));
     
             rrq->value = bitrate_table[ratemode].bitrate * 100000;
             rrq->fixed = ! bitrate_table[ratemode].automatic;
    Index: working-2.6/drivers/net/wireless/orinoco_tmd.c
    ===================================================================
    --- working-2.6.orig/drivers/net/wireless/orinoco_tmd.c 2004-07-28 15:05:39.588627448 +1000
    +++ working-2.6/drivers/net/wireless/orinoco_tmd.c 2004-07-28 15:05:40.435498704 +1000
    @@ -172,8 +172,7 @@
     {
             struct net_device *dev = pci_get_drvdata(pdev);
     
    - if (! dev)
    - BUG();
    + BUG_ON(! dev);
     
             unregister_netdev(dev);
                     
    Index: working-2.6/drivers/net/wireless/orinoco_cs.c
    ===================================================================
    --- working-2.6.orig/drivers/net/wireless/orinoco_cs.c 2004-07-28 15:05:39.596626232 +1000
    +++ working-2.6/drivers/net/wireless/orinoco_cs.c 2004-07-28 15:05:40.437498400 +1000
    @@ -228,10 +228,8 @@
             for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
                     if (*linkp == link)
                             break;
    - if (*linkp == NULL) {
    - BUG();
    - return;
    - }
    +
    + BUG_ON(*linkp == NULL);
     
             if (link->state & DEV_CONFIG)
                     orinoco_cs_release(link);
    Index: working-2.6/drivers/net/wireless/orinoco_plx.c
    ===================================================================
    --- working-2.6.orig/drivers/net/wireless/orinoco_plx.c 2004-07-28 15:05:39.592626840 +1000
    +++ working-2.6/drivers/net/wireless/orinoco_plx.c 2004-07-28 15:05:40.438498248 +1000
    @@ -286,8 +286,7 @@
     {
             struct net_device *dev = pci_get_drvdata(pdev);
     
    - if (! dev)
    - BUG();
    + BUG_ON(! dev);
     
             unregister_netdev(dev);
                     

    -- 
    David Gibson			| For every complex problem there is a
    david AT gibson.dropbear.id.au	| solution which is simple, neat and
    				| wrong.
    http://www.ozlabs.org/people/dgibson
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: David Gibson: "[9/15] orinoco merge preliminaries - make things static"

    Relevant Pages

    • Re: GTK update problems
      ... This upgrade seems to have broken many packages. ... > This probably reflects a bug in the program. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
      (Debian-User)
    • Update: Re: GTK update problems
      ... In my case, multi-gnome-terminal failed to start, leaving an error message in .xsession-errors. ... It seems to breaks totem, which issues many copies of the following error message: ... > This probably reflects a bug in the program. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
      (Debian-User)
    • Re: [opensuse] Please vote for Dolphin Crashes when connecting to MS share
      ... This bug has been around for a while and I think I'm the only voter. ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ... Head of EDD Tape Extraction and Processing team ...
      (SuSE)
    • Re: RPM functions taking forever
      ... escribió:> Richard S. Crawford wrote: ... > This is a know bug and due to stale RPM lock file. ... removing packages with: ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • Re: Logrotate error in lenny
      ... # Really no mysqld or rather a missing debian-sys-maint user? ... The first test succeeds; the second fails. ... how do I fix it / should follow the instruction to raise a bug? ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
      (Debian-User)