From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: jgross@suse.com, sstabellini@kernel.org,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON()
Date: Wed, 17 Mar 2021 18:31:20 -0400 [thread overview]
Message-ID: <5ae410c5-6b7a-70d4-128a-255f80cddda3@oracle.com> (raw)
In-Reply-To: <1615950299-96787-1-git-send-email-jiapeng.chong@linux.alibaba.com>
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;
> }
prev parent reply other threads:[~2021-03-17 22:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 3:04 Jiapeng Chong
2021-03-17 22:31 ` Boris Ostrovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ae410c5-6b7a-70d4-128a-255f80cddda3@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®