Commit 9ba025f1 authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Adrian Bunk

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: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent 7ec70738
...@@ -91,8 +91,8 @@ static inline int shm_addid(struct shmid_kernel *shp) ...@@ -91,8 +91,8 @@ static inline int shm_addid(struct shmid_kernel *shp)
static inline void shm_inc (int id) { static inline void shm_inc (int id) {
struct shmid_kernel *shp; struct shmid_kernel *shp;
if(!(shp = shm_lock(id))) shp = shm_lock(id);
BUG(); BUG_ON(!shp);
shp->shm_atim = get_seconds(); shp->shm_atim = get_seconds();
shp->shm_lprid = current->tgid; shp->shm_lprid = current->tgid;
shp->shm_nattch++; shp->shm_nattch++;
...@@ -142,8 +142,8 @@ static void shm_close (struct vm_area_struct *shmd) ...@@ -142,8 +142,8 @@ static void shm_close (struct vm_area_struct *shmd)
mutex_lock(&shm_ids.mutex); mutex_lock(&shm_ids.mutex);
/* remove from the list of attaches of the shm segment */ /* remove from the list of attaches of the shm segment */
if(!(shp = shm_lock(id))) shp = shm_lock(id);
BUG(); BUG_ON(!shp);
shp->shm_lprid = current->tgid; shp->shm_lprid = current->tgid;
shp->shm_dtim = get_seconds(); shp->shm_dtim = get_seconds();
shp->shm_nattch--; shp->shm_nattch--;
...@@ -283,8 +283,7 @@ asmlinkage long sys_shmget (key_t key, size_t size, int shmflg) ...@@ -283,8 +283,7 @@ asmlinkage long sys_shmget (key_t key, size_t size, int shmflg)
err = -EEXIST; err = -EEXIST;
} else { } else {
shp = shm_lock(id); shp = shm_lock(id);
if(shp==NULL) BUG_ON(shp==NULL);
BUG();
if (shp->shm_segsz < size) if (shp->shm_segsz < size)
err = -EINVAL; err = -EINVAL;
else if (ipcperms(&shp->shm_perm, shmflg)) else if (ipcperms(&shp->shm_perm, shmflg))
...@@ -774,8 +773,8 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr) ...@@ -774,8 +773,8 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
mutex_lock(&shm_ids.mutex); mutex_lock(&shm_ids.mutex);
if(!(shp = shm_lock(shmid))) shp = shm_lock(shmid);
BUG(); BUG_ON(!shp);
shp->shm_nattch--; shp->shm_nattch--;
if(shp->shm_nattch == 0 && if(shp->shm_nattch == 0 &&
shp->shm_perm.mode & SHM_DEST) shp->shm_perm.mode & SHM_DEST)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment