History

workqueue: BUG_ON() instead of returning NULL in wq_node_nr_active()

wq_node_nr_active() warns and returns NULL when @wq is not unbound, but every caller dereferences the result right away, so the WARN_ON_ONCE() only moves the oops one frame up, as raised by Tejun. Fix it by BUGing_ON() instead of this silly WARN_ON_ONCE();

Breno Leitao committed 3 months ago

Commit 4e0ee511 parent 1d125f01 file · +1 −2Browse files

Unified · Split

kernel/workqueue.c+1−2
@@ -1625,8 +1625,7 @@ static bool is_percpu_pool(struct worker_pool *pool) · 1624 unmodified lines
16251625 static struct wq_node_nr_active *wq_node_nr_active(struct workqueue_struct *wq,
16261626 int node)
16271627 {
1628− if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND)))
1629− return NULL;
1628+ BUG_ON(!(wq->flags & WQ_UNBOUND));
16301629
16311630 if (node == NUMA_NO_NODE)
16321631 node = nr_node_ids;