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

From: David Gibson
Date: Wed Jul 28 2004 - 02:20:25 EST


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

Signed-off-by: David Gibson <hermes@xxxxxxxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/