]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
workqueue: change BUG_ON() to WARN_ON()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 13 Apr 2012 19:06:58 +0000 (22:06 +0300)
committerTejun Heo <tj@kernel.org>
Mon, 16 Apr 2012 21:54:59 +0000 (14:54 -0700)
This BUG_ON() can be triggered if you call schedule_work() before
calling INIT_WORK().  It is a bug definitely, but it's nicer to just
print a stack trace and return.

Reported-by: Matt Renzelmann <mjr@cs.wisc.edu>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index 5abf42f63c0825f31164a9debc4e30c06ce1f9ee..66ec08de6dac515fe0fff8ac87032788dfe0210b 100644 (file)
@@ -1032,7 +1032,10 @@ static void __queue_work(unsigned int cpu, struct workqueue_struct *wq,
        cwq = get_cwq(gcwq->cpu, wq);
        trace_workqueue_queue_work(cpu, cwq, work);
 
-       BUG_ON(!list_empty(&work->entry));
+       if (WARN_ON(!list_empty(&work->entry))) {
+               spin_unlock_irqrestore(&gcwq->lock, flags);
+               return;
+       }
 
        cwq->nr_in_flight[cwq->work_color]++;
        work_flags = work_color_to_flags(cwq->work_color);