All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@fs.tum.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [2.6 patch][1/3] ipc/ BUG -> BUG_ON conversions
Date: Sat, 28 Aug 2004 17:15:44 +0200	[thread overview]
Message-ID: <20040828151544.GB12772@fs.tum.de> (raw)
In-Reply-To: <20040828151137.GA12772@fs.tum.de>

The patch below does BUG -> BUG_ON conversions in ipc/ .

diffstat output:
 ipc/msg.c  |    3 +--
 ipc/sem.c  |    6 ++----
 ipc/shm.c  |   12 ++++--------
 ipc/util.c |    6 ++----
 4 files changed, 9 insertions(+), 18 deletions(-)


Signed-off-by: Adrian Bunk <bunk@fs.tum.de>

--- linux-2.6.9-rc1-mm1-full-3.4/ipc/msg.c.old	2004-08-28 15:55:28.000000000 +0200
+++ linux-2.6.9-rc1-mm1-full-3.4/ipc/msg.c	2004-08-28 16:01:42.000000000 +0200
@@ -215,8 +215,7 @@
 		ret = -EEXIST;
 	} else {
 		msq = msg_lock(id);
-		if(msq==NULL)
-			BUG();
+		BUG_ON(msq == NULL);
 		if (ipcperms(&msq->q_perm, msgflg))
 			ret = -EACCES;
 		else {
--- linux-2.6.9-rc1-mm1-full-3.4/ipc/sem.c.old	2004-08-28 15:55:28.000000000 +0200
+++ linux-2.6.9-rc1-mm1-full-3.4/ipc/sem.c	2004-08-28 16:02:09.000000000 +0200
@@ -222,8 +222,7 @@
 		err = -EEXIST;
 	} else {
 		sma = sem_lock(id);
-		if(sma==NULL)
-			BUG();
+		BUG_ON(sma == NULL);
 		if (nsems > sma->sem_nsems)
 			err = -EINVAL;
 		else if (ipcperms(&sma->sem_perm, semflg))
@@ -1160,8 +1159,7 @@
 
 	sma = sem_lock(semid);
 	if(sma==NULL) {
-		if(queue.prev != NULL)
-			BUG();
+		BUG_ON(queue.prev != NULL);
 		error = -EIDRM;
 		goto out_free;
 	}
--- linux-2.6.9-rc1-mm1-full-3.4/ipc/shm.c.old	2004-08-28 15:55:28.000000000 +0200
+++ linux-2.6.9-rc1-mm1-full-3.4/ipc/shm.c	2004-08-28 16:02:56.000000000 +0200
@@ -86,8 +86,7 @@
 static inline void shm_inc (int id) {
 	struct shmid_kernel *shp;
 
-	if(!(shp = shm_lock(id)))
-		BUG();
+	BUG_ON(!(shp = shm_lock(id)));
 	shp->shm_atim = get_seconds();
 	shp->shm_lprid = current->tgid;
 	shp->shm_nattch++;
@@ -137,8 +136,7 @@
 
 	down (&shm_ids.sem);
 	/* remove from the list of attaches of the shm segment */
-	if(!(shp = shm_lock(id)))
-		BUG();
+	BUG_ON(!(shp = shm_lock(id)));
 	shp->shm_lprid = current->tgid;
 	shp->shm_dtim = get_seconds();
 	shp->shm_nattch--;
@@ -261,8 +259,7 @@
 		err = -EEXIST;
 	} else {
 		shp = shm_lock(id);
-		if(shp==NULL)
-			BUG();
+		BUG_ON(shp == NULL);
 		if (shp->shm_segsz < size)
 			err = -EINVAL;
 		else if (ipcperms(&shp->shm_perm, shmflg))
@@ -744,8 +741,7 @@
 	up_write(&current->mm->mmap_sem);
 
 	down (&shm_ids.sem);
-	if(!(shp = shm_lock(shmid)))
-		BUG();
+	BUG_ON(!(shp = shm_lock(shmid)));
 	shp->shm_nattch--;
 	if(shp->shm_nattch == 0 &&
 	   shp->shm_flags & SHM_DEST)
--- linux-2.6.9-rc1-mm1-full-3.4/ipc/util.c.old	2004-08-28 15:55:28.000000000 +0200
+++ linux-2.6.9-rc1-mm1-full-3.4/ipc/util.c	2004-08-28 16:03:24.000000000 +0200
@@ -216,8 +216,7 @@
 {
 	struct kern_ipc_perm* p;
 	int lid = id % SEQ_MULTIPLIER;
-	if(lid >= ids->size)
-		BUG();
+	BUG_ON(lid >= ids->size);
 
 	/* 
 	 * do not need a rcu_dereference()() here to force ordering
@@ -225,8 +224,7 @@
 	 */	
 	p = ids->entries[lid].p;
 	ids->entries[lid].p = NULL;
-	if(p==NULL)
-		BUG();
+	BUG_ON(p == NULL);
 	ids->in_use--;
 
 	if (lid == ids->max_id) {

  reply	other threads:[~2004-08-28 15:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-28 15:11 [2.6 patch][0/3] BUG -> BUG_ON conversions Adrian Bunk
2004-08-28 15:15 ` Adrian Bunk [this message]
2004-08-28 16:05   ` [2.6 patch][1/3] ipc/ " Kyle Moffett
2004-08-28 16:26     ` Adrian Bunk
2004-08-28 16:50       ` Michael Buesch
2004-08-28 19:58       ` Andrew Morton
2004-08-28 20:22         ` Adrian Bunk
2004-08-28 20:59         ` Jens Axboe
2004-08-28 21:43         ` Matt Mackall
2004-08-28 15:17 ` [2.6 patch][2/3] kernel/ " Adrian Bunk
2004-08-28 16:09   ` Kyle Moffett
2004-08-28 15:18 ` [2.6 patch][3/3] mm/ " Adrian Bunk
2004-08-28 16:32   ` Denis Vlasenko
2004-08-28 20:58     ` Jens Axboe
2004-08-28 21:24       ` Adrian Bunk
2004-08-29 12:03         ` Jens Axboe
2004-08-29 12:18           ` Oliver Neukum
2004-08-29 13:01             ` Jens Axboe
2004-08-29 13:50               ` Adrian Bunk
2004-08-29 14:08                 ` Jens Axboe

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=20040828151544.GB12772@fs.tum.de \
    --to=bunk@fs.tum.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.