Skip to contentSkip to conversation

sched: replace if (cond) BUG() with BUG_ON()

PATCH New Jiapeng Chong 1 participant 1 message Mar 17, 2021 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sched: replace if (cond) BUG() with BUG_ON()

Fix the following coccicheck warnings:

./kernel/sched/core.c:8039:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.

---
Changes in v2:
- Replace BUG with BUG_ON.

 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +1 -2
index 9819121..052f290 100644
@@ -8035,8 +8035,7 @@ void __init sched_init_smp(void)
 	mutex_unlock(&sched_domains_mutex);
 
 	/* Move init over to a non-isolated CPU */
-	if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
-		BUG();
+	BUG_ON(set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0);
 	sched_init_granularity();
 
 	init_sched_rt_class();
Signature · 1 line
1.8.3.1