* [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; 2+ messages in thread
From: Jiapeng Chong @ 2021-03-17 6:45 UTC (permalink / raw)
To: jk; +Cc: Jiapeng Chong, arnd, linux-kernel, paulus, linuxppc-dev
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] 2+ messages in thread
* Re: [PATCH] sched: replace if (cond) BUG() with BUG_ON()
2021-03-17 6:45 [PATCH] sched: replace if (cond) BUG() with BUG_ON() Jiapeng Chong
@ 2021-03-17 7:00 ` Christophe Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy @ 2021-03-17 7:00 UTC (permalink / raw)
To: Jiapeng Chong, jk; +Cc: linuxppc-dev, paulus, linux-kernel, arnd
Le 17/03/2021 à 07:45, Jiapeng Chong a écrit :
> 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.
Consider using WARN_ON() instead of BUG_ON() if relevant. If not, explain in the commit message why
we need to keep a BUG_ON().
See https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on
>
> 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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-17 7:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 6:45 [PATCH] sched: replace if (cond) BUG() with BUG_ON() 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;
as well as URLs for NNTP newsgroup(s).