summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-04-02 13:42:42 +0200
committerAdrian Bunk <bunk@stusta.de>2006-04-02 13:42:42 +0200
commit9ba025f10885758975fbbc2292a5b9e7cb8026a8 (patch)
tree2b6b88de37c42db0541ddf929d0a38b60f4a5871
parent7ec70738097af9dfd25d5f83e9b27a532f462912 (diff)
downloadlinux-3.10-9ba025f10885758975fbbc2292a5b9e7cb8026a8.tar.gz
linux-3.10-9ba025f10885758975fbbc2292a5b9e7cb8026a8.tar.bz2
linux-3.10-9ba025f10885758975fbbc2292a5b9e7cb8026a8.zip
BUG_ON() Conversion in ipc/shm.c
this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
-rw-r--r--ipc/shm.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index f806a2e314e..6b0c9af5bbf 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -91,8 +91,8 @@ static inline int shm_addid(struct shmid_kernel *shp)
static inline void shm_inc (int id) {
struct shmid_kernel *shp;
- if(!(shp = shm_lock(id)))
- BUG();
+ shp = shm_lock(id);
+ BUG_ON(!shp);
shp->shm_atim = get_seconds();
shp->shm_lprid = current->tgid;
shp->shm_nattch++;
@@ -142,8 +142,8 @@ static void shm_close (struct vm_area_struct *shmd)
mutex_lock(&shm_ids.mutex);
/* remove from the list of attaches of the shm segment */
- if(!(shp = shm_lock(id)))
- BUG();
+ shp = shm_lock(id);
+ BUG_ON(!shp);
shp->shm_lprid = current->tgid;
shp->shm_dtim = get_seconds();
shp->shm_nattch--;
@@ -283,8 +283,7 @@ asmlinkage long sys_shmget (key_t key, size_t size, int shmflg)
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))
@@ -774,8 +773,8 @@ invalid:
up_write(&current->mm->mmap_sem);
mutex_lock(&shm_ids.mutex);
- if(!(shp = shm_lock(shmid)))
- BUG();
+ shp = shm_lock(shmid);
+ BUG_ON(!shp);
shp->shm_nattch--;
if(shp->shm_nattch == 0 &&
shp->shm_perm.mode & SHM_DEST)