diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-04-13 22:06:58 +0300 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-04-16 14:54:59 -0700 |
commit | f5b2552b4ebbeadcadde1532d7bbd3f850719046 (patch) | |
tree | 89bbf52668883f0a4c65ed10bd113a5cc4d75721 /kernel/workqueue.c | |
parent | d3283fb45c06dfd7b1a36da8e6ff39d313f0600c (diff) |
workqueue: change BUG_ON() to WARN_ON()
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>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 5abf42f63c0..66ec08de6da 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -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); |