From: Linus Torvalds Date: Sat, 4 May 2013 18:04:29 +0000 (-0700) Subject: ipc: simplify rcu_read_lock() in semctl_nolock() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=941b0304a74b240c607ff098401fd4ef70c9d1cc;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ipc: simplify rcu_read_lock() in semctl_nolock() 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 Cc: Rik van Riel Cc: Al Viro Signed-off-by: Linus Torvalds --- diff --git a/ipc/sem.c b/ipc/sem.c index f2151babd26a..899b598b63be 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -948,8 +948,8 @@ 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); @@ -957,7 +957,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, } id = sma->sem_perm.id; } else { - rcu_read_lock(); sma = sem_obtain_object_check(ns, semid); if (IS_ERR(sma)) { err = PTR_ERR(sma);