From: Oleg Nesterov But it is a bit silly to have 2 variables, we need only one. Signed-off-by: Oleg Nesterov Signed-off-by: Andrew Morton --- kernel/workqueue.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff -puN kernel/workqueue.c~simplify-cleanup_workqueue_thread-fix2 kernel/workqueue.c --- a/kernel/workqueue.c~simplify-cleanup_workqueue_thread-fix2 +++ a/kernel/workqueue.c @@ -330,7 +330,7 @@ static void insert_wq_barrier(struct cpu static int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) { - int ret; + int active; if (cwq->thread == current) { /* @@ -338,11 +338,11 @@ static int flush_cpu_workqueue(struct cp * it by hand rather than deadlocking. */ run_workqueue(cwq); - ret = 1; + active = 1; } else { struct wq_barrier barr; - int active = 0; + active = 0; spin_lock_irq(&cwq->lock); if (!list_empty(&cwq->worklist) || cwq->current_work != NULL) { insert_wq_barrier(cwq, &barr, 1); @@ -352,10 +352,9 @@ static int flush_cpu_workqueue(struct cp if (active) wait_for_completion(&barr.done); - - ret = active; } - return ret; + + return active; } /** _