public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] if(foo) BUG() -> BUG_ON(foo) for include/linux/
Date: Wed, 24 Sep 2003 12:36:31 +0200	[thread overview]
Message-ID: <200309241236.31384@bilbo.math.uni-mannheim.de> (raw)
In-Reply-To: <200309241234.58125@bilbo.math.uni-mannheim.de>

diff -aur linux-2.6.0-test5-bk10/include/linux/bio.h linux-2.6.0-test5-bk10-test/include/linux/bio.h
--- linux-2.6.0-test5-bk10/include/linux/bio.h	2003-09-23 20:07:15.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/bio.h	2003-09-23 21:40:51.000000000 +0200
@@ -266,8 +266,7 @@
 	local_irq_save(*flags);
 	addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ);
 
-	if (addr & ~PAGE_MASK)
-		BUG();
+	BUG_ON(addr & ~PAGE_MASK);
 
 	return (char *) addr + bvec->bv_offset;
 }
Nur in linux-2.6.0-test5-bk10-test/include/linux/: bio.h.orig.
diff -aur linux-2.6.0-test5-bk10/include/linux/buffer_head.h linux-2.6.0-test5-bk10-test/include/linux/buffer_head.h
--- linux-2.6.0-test5-bk10/include/linux/buffer_head.h	2003-09-08 21:49:51.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/buffer_head.h	2003-09-23 21:40:51.000000000 +0200
@@ -125,8 +125,7 @@
 /* If we *know* page->private refers to buffer_heads */
 #define page_buffers(page)					\
 	({							\
-		if (!PagePrivate(page))				\
-			BUG();					\
+		BUG_ON(!PagePrivate(page));		\
 		((struct buffer_head *)(page)->private);	\
 	})
 #define page_has_buffers(page)	PagePrivate(page)
diff -aur linux-2.6.0-test5-bk10/include/linux/dcache.h linux-2.6.0-test5-bk10-test/include/linux/dcache.h
--- linux-2.6.0-test5-bk10/include/linux/dcache.h	2003-09-08 21:50:42.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/dcache.h	2003-09-23 21:40:51.000000000 +0200
@@ -270,8 +270,7 @@
 static inline struct dentry *dget(struct dentry *dentry)
 {
 	if (dentry) {
-		if (!atomic_read(&dentry->d_count))
-			BUG();
+		BUG_ON(!atomic_read(&dentry->d_count));
 		atomic_inc(&dentry->d_count);
 	}
 	return dentry;
diff -aur linux-2.6.0-test5-bk10/include/linux/highmem.h linux-2.6.0-test5-bk10-test/include/linux/highmem.h
--- linux-2.6.0-test5-bk10/include/linux/highmem.h	2003-09-08 21:50:19.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/highmem.h	2003-09-23 21:40:51.000000000 +0200
@@ -56,8 +56,7 @@
 {
 	void *kaddr;
 
-	if (offset + size > PAGE_SIZE)
-		BUG();
+	BUG_ON(offset + size > PAGE_SIZE);
 
 	kaddr = kmap_atomic(page, KM_USER0);
 	memset((char *)kaddr + offset, 0, size);
diff -aur linux-2.6.0-test5-bk10/include/linux/netdevice.h linux-2.6.0-test5-bk10-test/include/linux/netdevice.h
--- linux-2.6.0-test5-bk10/include/linux/netdevice.h	2003-09-23 20:07:17.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/netdevice.h	2003-09-23 21:40:51.000000000 +0200
@@ -827,7 +827,7 @@
 	unsigned long flags;
 
 	local_irq_save(flags);
-	if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
+	BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state));
 	list_del(&dev->poll_list);
 	smp_mb__before_clear_bit();
 	clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
@@ -853,7 +853,7 @@
  */
 static inline void __netif_rx_complete(struct net_device *dev)
 {
-	if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
+	BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state));
 	list_del(&dev->poll_list);
 	smp_mb__before_clear_bit();
 	clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
Nur in linux-2.6.0-test5-bk10-test/include/linux/: netdevice.h.orig.
diff -aur linux-2.6.0-test5-bk10/include/linux/nfs_fs.h linux-2.6.0-test5-bk10-test/include/linux/nfs_fs.h
--- linux-2.6.0-test5-bk10/include/linux/nfs_fs.h	2003-09-08 21:50:01.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/nfs_fs.h	2003-09-23 21:40:51.000000000 +0200
@@ -262,8 +262,7 @@
 	if (file)
 		cred = (struct rpc_cred *)file->private_data;
 #ifdef RPC_DEBUG
-	if (cred && cred->cr_magic != RPCAUTH_CRED_MAGIC)
-		BUG();
+	BUG_ON(cred && cred->cr_magic != RPCAUTH_CRED_MAGIC);
 #endif
 	return cred;
 }
diff -aur linux-2.6.0-test5-bk10/include/linux/quotaops.h linux-2.6.0-test5-bk10-test/include/linux/quotaops.h
--- linux-2.6.0-test5-bk10/include/linux/quotaops.h	2003-09-08 21:49:58.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/quotaops.h	2003-09-23 21:40:51.000000000 +0200
@@ -44,8 +44,7 @@
 
 static __inline__ void DQUOT_INIT(struct inode *inode)
 {
-	if (!inode->i_sb)
-		BUG();
+	BUG_ON(!inode->i_sb);
 	if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
 		inode->i_sb->dq_op->initialize(inode, -1);
 }
@@ -53,8 +52,7 @@
 static __inline__ void DQUOT_DROP(struct inode *inode)
 {
 	if (IS_QUOTAINIT(inode)) {
-		if (!inode->i_sb)
-			BUG();
+		BUG_ON(!inode->i_sb);
 		inode->i_sb->dq_op->drop(inode);	/* Ops must be set when there's any quota... */
 	}
 }
diff -aur linux-2.6.0-test5-bk10/include/linux/smp_lock.h linux-2.6.0-test5-bk10-test/include/linux/smp_lock.h
--- linux-2.6.0-test5-bk10/include/linux/smp_lock.h	2003-09-08 21:50:21.000000000 +0200
+++ linux-2.6.0-test5-bk10-test/include/linux/smp_lock.h	2003-09-23 21:40:51.000000000 +0200
@@ -49,8 +49,7 @@
 
 static inline void unlock_kernel(void)
 {
-	if (unlikely(current->lock_depth < 0))
-		BUG();
+	BUG_ON(current->lock_depth < 0);
 	if (likely(--current->lock_depth < 0))
 		put_kernel_lock();
 }

  reply	other threads:[~2003-09-24 10:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-24 10:33 [PATCH] if(foo) BUG() -> BUG_ON(foo) for include/rxrpc/ Rolf Eike Beer
2003-09-24 10:34 ` [PATCH] if(foo) BUG() -> BUG_ON(foo) for include/net/ Rolf Eike Beer
2003-09-24 10:36   ` Rolf Eike Beer [this message]
2003-09-24 10:52     ` [PATCH] if(foo) BUG() -> BUG_ON(foo) for include/arch/ Rolf Eike Beer
2003-10-03 22:11       ` Randy.Dunlap

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=200309241236.31384@bilbo.math.uni-mannheim.de \
    --to=eike-kernel@sf-tec.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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