diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-02-08 07:19:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:26 -0500 |
commit | 9cbab8100538efdd93aeae6fc37787d986f2f558 (patch) | |
tree | a34cf1b3d6bdb3b2bbede801a9acdb23d35903ff /kernel | |
parent | ee7c82da830ea860b1f9274f1f0cdf99f206e7c2 (diff) |
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: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index da293ac7e379..723a69b69fa1 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1511,6 +1511,7 @@ repeat: | |||
1511 | } | 1511 | } |
1512 | allowed = 1; | 1512 | allowed = 1; |
1513 | 1513 | ||
1514 | retval = 0; | ||
1514 | if (task_is_stopped_or_traced(p)) { | 1515 | if (task_is_stopped_or_traced(p)) { |
1515 | /* | 1516 | /* |
1516 | * It's stopped now, so it might later | 1517 | * It's stopped now, so it might later |
@@ -1524,8 +1525,6 @@ repeat: | |||
1524 | retval = wait_task_stopped(p, ret == 2, | 1525 | retval = wait_task_stopped(p, ret == 2, |
1525 | (options & WNOWAIT), infop, | 1526 | (options & WNOWAIT), infop, |
1526 | stat_addr, ru); | 1527 | stat_addr, ru); |
1527 | if (retval != 0) /* He released the lock. */ | ||
1528 | goto end; | ||
1529 | } else if (p->exit_state == EXIT_ZOMBIE) { | 1528 | } else if (p->exit_state == EXIT_ZOMBIE) { |
1530 | /* | 1529 | /* |
1531 | * Eligible but we cannot release it yet: | 1530 | * Eligible but we cannot release it yet: |
@@ -1537,9 +1536,6 @@ repeat: | |||
1537 | retval = wait_task_zombie(p, | 1536 | retval = wait_task_zombie(p, |
1538 | (options & WNOWAIT), infop, | 1537 | (options & WNOWAIT), infop, |
1539 | stat_addr, ru); | 1538 | stat_addr, ru); |
1540 | /* He released the lock. */ | ||
1541 | if (retval != 0) | ||
1542 | goto end; | ||
1543 | } else if (p->exit_state != EXIT_DEAD) { | 1539 | } else if (p->exit_state != EXIT_DEAD) { |
1544 | check_continued: | 1540 | check_continued: |
1545 | /* | 1541 | /* |
@@ -1552,9 +1548,9 @@ check_continued: | |||
1552 | retval = wait_task_continued(p, | 1548 | retval = wait_task_continued(p, |
1553 | (options & WNOWAIT), infop, | 1549 | (options & WNOWAIT), infop, |
1554 | stat_addr, ru); | 1550 | stat_addr, ru); |
1555 | if (retval != 0) /* He released the lock. */ | ||
1556 | goto end; | ||
1557 | } | 1551 | } |
1552 | if (retval != 0) /* tasklist_lock released */ | ||
1553 | goto end; | ||
1558 | } | 1554 | } |
1559 | if (!flag) { | 1555 | if (!flag) { |
1560 | list_for_each_entry(p, &tsk->ptrace_children, | 1556 | list_for_each_entry(p, &tsk->ptrace_children, |
@@ -1590,7 +1586,7 @@ end: | |||
1590 | remove_wait_queue(¤t->signal->wait_chldexit,&wait); | 1586 | remove_wait_queue(¤t->signal->wait_chldexit,&wait); |
1591 | if (infop) { | 1587 | if (infop) { |
1592 | if (retval > 0) | 1588 | if (retval > 0) |
1593 | retval = 0; | 1589 | retval = 0; |
1594 | else { | 1590 | else { |
1595 | /* | 1591 | /* |
1596 | * For a WNOHANG return, clear out all the fields | 1592 | * For a WNOHANG return, clear out all the fields |