public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <hermes@gibson.dropbear.id.au>
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>
Subject: [8/15] orinoco merge preliminaries - use BUG_ON()
Date: Wed, 28 Jul 2004 16:57:25 +1000	[thread overview]
Message-ID: <20040728065725.GK16908@zax> (raw)
In-Reply-To: <20040728065659.GJ16908@zax>

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

  reply	other threads:[~2004-07-28  7:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-12 19:33 [PATCH] Slowly update in-kernel orinoco drivers to upstream current CVS Francois Romieu
2004-07-14 18:37 ` Jeff Garzik
2004-07-15  1:01   ` David Gibson
2004-07-17 11:45     ` Francois Romieu
2004-07-27 17:18     ` Jeff Garzik
2004-07-28  6:51       ` [0/15] orinoco merge preliminaries David Gibson
2004-07-28  6:53         ` [1/15] orinoco merge preliminaries - squash backwards compatibility David Gibson
2004-07-28  6:53           ` [2/15] orinoco merge preliminaries - rearrange code David Gibson
2004-07-28  6:54             ` [3/15] orinoco merge preliminaries - use netdev_priv() David Gibson
2004-07-28  6:54               ` [4/15] orinoco merge preliminaries - use ALIGN() David Gibson
2004-07-28  6:55                 ` [5/15] orinoco merge preliminaries - use ARRAY_SIZE() David Gibson
2004-07-28  6:55                   ` [6/15] orinoco merge preliminaries - spam stoppers David Gibson
2004-07-28  6:56                     ` [7/15] orinoco merge preliminaries - comment/whitespace/spelling updates David Gibson
2004-07-28  6:57                       ` David Gibson [this message]
2004-07-28  6:58                         ` [9/15] orinoco merge preliminaries - make things static David Gibson
2004-07-28  6:58                           ` [10/15] orinoco merge preliminaries - miscelaneous David Gibson
2004-07-28  6:59                             ` [11/15] orinoco merge preliminaries - use name/version macros David Gibson
2004-07-28  6:59                               ` [12/15] orinoco merge preliminaries - remove unneeded #includes David Gibson
2004-07-28  7:00                                 ` [13/15] orinoco merge preliminaries - don't typedef structs David Gibson
2004-07-28  7:00                                   ` [14/15] orinoco merge preliminaries - more HW data David Gibson
2004-07-28  7:01                                     ` [15/15] orinoco merge preliminaries - update authorship information David Gibson
2004-07-28 16:55                                       ` Jeff Garzik
2004-07-28 17:36                     ` [6/15] orinoco merge preliminaries - spam stoppers Matt Mackall
2004-07-28 22:50         ` [0/15] orinoco merge preliminaries Francois Romieu
2004-07-29  0:19           ` David Gibson
2004-07-29 23:19             ` Francois Romieu
2004-09-08 15:18               ` Dan Williams
2004-09-09  3:13                 ` Jeff Garzik
2004-09-09 19:51                   ` Francois Romieu
2004-07-14 20:15 ` [PATCH] Slowly update in-kernel orinoco drivers to upstream current CVS Pavel Roskin
2004-07-15  1:26   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040728065725.GK16908@zax \
    --to=hermes@gibson.dropbear.id.au \
    --cc=dcbw@redhat.com \
    --cc=jgarzik@pobox.com \
    --cc=jt@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orinoco-devel@lists.sourceforge.net \
    --cc=proski@gnu.org \
    --cc=romieu@fr.zoreil.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox