* [PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON()
@ 2021-03-17 3:04 Jiapeng Chong
2021-03-17 22:31 ` Boris Ostrovsky
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-03-17 3:04 UTC (permalink / raw)
To: boris.ostrovsky
Cc: jgross, sstabellini, xen-devel, linux-kernel, Jiapeng Chong
Fix the following coccicheck warnings:
./drivers/xen/evtchn.c:412: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>
---
drivers/xen/evtchn.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index c99415a..b1c59bc 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -408,8 +408,7 @@ static int evtchn_bind_to_user(struct per_user_data *u, evtchn_port_t port)
err:
/* bind failed, should close the port now */
close.port = port;
- if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
- BUG();
+ BUG_ON(HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0);
del_evtchn(u, evtchn);
return rc;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON()
2021-03-17 3:04 [PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON() Jiapeng Chong
@ 2021-03-17 22:31 ` Boris Ostrovsky
0 siblings, 0 replies; 2+ messages in thread
From: Boris Ostrovsky @ 2021-03-17 22:31 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: jgross, sstabellini, xen-devel, linux-kernel
On 3/16/21 11:04 PM, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
>
> ./drivers/xen/evtchn.c:412: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>
> ---
> drivers/xen/evtchn.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
> index c99415a..b1c59bc 100644
> --- a/drivers/xen/evtchn.c
> +++ b/drivers/xen/evtchn.c
> @@ -408,8 +408,7 @@ static int evtchn_bind_to_user(struct per_user_data *u, evtchn_port_t port)
> err:
> /* bind failed, should close the port now */
> close.port = port;
> - if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
> - BUG();
> + BUG_ON(HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0);
Is it actually worth doing a BUG() here at all? Seems to me WARN_ON_ONCE() should be sufficient.
-boris
> del_evtchn(u, evtchn);
> return rc;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-17 22:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 3:04 [PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON() Jiapeng Chong
2021-03-17 22:31 ` Boris Ostrovsky
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).