public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: replace if (cond) BUG() with BUG_ON()
@ 2021-03-17  2:45 Jiapeng Chong
  2021-03-17  8:39 ` Ingo Molnar
  0 siblings, 1 reply; 8+ messages in thread
From: Jiapeng Chong @ 2021-03-17  2:45 UTC (permalink / raw)
  To: mingo
  Cc: peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
	bsegall, mgorman, bristot, linux-kernel, Jiapeng Chong

Fix the following coccicheck warnings:

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

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9819121..7392bc0 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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(set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0);
 	sched_init_granularity();
 
 	init_sched_rt_class();
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] sched: replace if (cond) BUG() with BUG_ON()
@ 2021-03-17  6:45 Jiapeng Chong
  2021-03-17  7:00 ` Christophe Leroy
  0 siblings, 1 reply; 8+ messages in thread
From: Jiapeng Chong @ 2021-03-17  6:45 UTC (permalink / raw)
  To: jk; +Cc: arnd, mpe, benh, paulus, linuxppc-dev, linux-kernel,
	Jiapeng Chong

Fix the following coccicheck warnings:

./arch/powerpc/platforms/cell/spufs/sched.c:908:2-5: WARNING: Use BUG_ON
instead of if condition followed by BUG.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 arch/powerpc/platforms/cell/spufs/sched.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 3692064..139a6ec 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -904,8 +904,7 @@ static noinline void spusched_tick(struct spu_context *ctx)
 	struct spu_context *new = NULL;
 	struct spu *spu = NULL;
 
-	if (spu_acquire(ctx))
-		BUG();	/* a kernel thread never has signals pending */
+	BUG_ON(spu_acquire(ctx));	/* a kernel thread never has signals pending */
 
 	if (ctx->state != SPU_STATE_RUNNABLE)
 		goto out;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-17 21:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-17  2:45 [PATCH] sched: replace if (cond) BUG() with BUG_ON() Jiapeng Chong
2021-03-17  8:39 ` Ingo Molnar
2021-03-17  8:41   ` Ingo Molnar
2021-03-17 12:55     ` Arnd Bergmann
2021-03-17 20:05       ` Ingo Molnar
2021-03-17 21:38         ` Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2021-03-17  6:45 Jiapeng Chong
2021-03-17  7:00 ` Christophe Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox