Skip to content

Commit c7f5194

Browse files
committed
posix-cpu-timer: Unify the now redundant code in lookup_task
Now that both !thread paths through lookup_task call thread_group_leader, unify them into the single test at the end of lookup_task. This unification just makes it clear what is happening in the gettime special case of lookup_task. Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 8feebc6 commit c7f5194

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

kernel/time/posix-cpu-timers.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,13 @@ static struct task_struct *lookup_task(const pid_t pid, bool thread,
6666
if (thread)
6767
return same_thread_group(p, current) ? p : NULL;
6868

69-
if (gettime) {
70-
/*
71-
* For clock_gettime(PROCESS) the task does not need to be
72-
* the actual group leader. task->signal gives
73-
* access to the group's clock.
74-
*/
75-
return (p == current || thread_group_leader(p)) ? p : NULL;
76-
}
69+
/*
70+
* For clock_gettime(PROCESS) the task does not need to be
71+
* the actual group leader. task->signal gives
72+
* access to the group's clock.
73+
*/
74+
if (gettime && (p == current))
75+
return p;
7776

7877
/*
7978
* For processes require that p is group leader.

0 commit comments

Comments
 (0)