mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -mm 3/2] do_wait: factor out "retval != 0" checks
@ 2007-11-22 16:15 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2007-11-22 16:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roland McGrath, linux-kernel

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>

--- PT/kernel/exit.c~3_result	2007-11-22 18:06:01.000000000 +0300
+++ PT/kernel/exit.c	2007-11-22 19:08:43.000000000 +0300
@@ -1508,6 +1508,7 @@ repeat:
 			}
 			allowed = 1;
 
+			retval = 0;
 			if (is_task_stopped_or_traced(p)) {
 				/*
 				 * It's stopped now, so it might later
@@ -1521,8 +1522,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:
@@ -1534,9 +1533,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:
 				/*
@@ -1549,9 +1545,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,
@@ -1587,7 +1583,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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-22 16:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-22 16:15 [PATCH -mm 3/2] do_wait: factor out "retval != 0" checks Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®