[PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON()

From: Jiapeng Chong
Date: Tue Mar 16 2021 - 23:05:59 EST


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@xxxxxxxxxxxxxxxxx>
Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
---
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