Commit 9cbab810 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

do_wait: factor out "retval != 0" checks

Every branch if the main "if" statement does the same code at the end.  Move
it down.  Also, fix the indentation.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ee7c82da
......@@ -1511,6 +1511,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
}
allowed = 1;
retval = 0;
if (task_is_stopped_or_traced(p)) {
/*
* It's stopped now, so it might later
......@@ -1524,8 +1525,6 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
retval = wait_task_stopped(p, ret == 2,
(options & WNOWAIT), infop,
stat_addr, ru);
if (retval != 0) /* He released the lock. */
goto end;
} else if (p->exit_state == EXIT_ZOMBIE) {
/*
* Eligible but we cannot release it yet:
......@@ -1537,9 +1536,6 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
retval = wait_task_zombie(p,
(options & WNOWAIT), infop,
stat_addr, ru);
/* He released the lock. */
if (retval != 0)
goto end;
} else if (p->exit_state != EXIT_DEAD) {
check_continued:
/*
......@@ -1552,9 +1548,9 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
retval = wait_task_continued(p,
(options & WNOWAIT), infop,
stat_addr, ru);
if (retval != 0) /* He released the lock. */
goto end;
}
if (retval != 0) /* tasklist_lock released */
goto end;
}
if (!flag) {
list_for_each_entry(p, &tsk->ptrace_children,
......@@ -1590,7 +1586,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
remove_wait_queue(&current->signal->wait_chldexit,&wait);
if (infop) {
if (retval > 0)
retval = 0;
retval = 0;
else {
/*
* For a WNOHANG return, clear out all the fields
......
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