Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9cbab8100538efdd93aeae6fc37787d986f2f558
Commit:     9cbab8100538efdd93aeae6fc37787d986f2f558
Parent:     ee7c82da830ea860b1f9274f1f0cdf99f206e7c2
Author:     Oleg Nesterov <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 8 04:19:02 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Feb 8 09:22:26 2008 -0800

    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 <[EMAIL PROTECTED]>
    Cc: Roland McGrath <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/exit.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index da293ac..723a69b 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1511,6 +1511,7 @@ repeat:
                        }
                        allowed = 1;
 
+                       retval = 0;
                        if (task_is_stopped_or_traced(p)) {
                                /*
                                 * It's stopped now, so it might later
@@ -1524,8 +1525,6 @@ repeat:
                                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 @@ repeat:
                                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 @@ check_continued:
                                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 @@ end:
        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
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to