Skip to content

Commit

Permalink
ipc: simplify rcu_read_lock() in semctl_nolock()
Browse files Browse the repository at this point in the history
This trivially combines two rcu_read_lock() calls in both sides of a
if-statement into one single one in front of the if-statement.

Split out as an independent cleanup from the previous commit.

Acked-by: Davidlohr Bueso <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed May 5, 2013
1 parent c728b9c commit 941b030
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ipc/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,16 +948,15 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,

memset(&tbuf, 0, sizeof(tbuf));

rcu_read_lock();
if (cmd == SEM_STAT) {
rcu_read_lock();
sma = sem_obtain_object(ns, semid);
if (IS_ERR(sma)) {
err = PTR_ERR(sma);
goto out_unlock;
}
id = sma->sem_perm.id;
} else {
rcu_read_lock();
sma = sem_obtain_object_check(ns, semid);
if (IS_ERR(sma)) {
err = PTR_ERR(sma);
Expand Down

0 comments on commit 941b030

Please sign in to comment.