[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON()
- To: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Wed, 17 Mar 2021 18:31:20 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1xsl4Sp7vVhV1/McVvgxVvbShTrrJX7i6O0SN0cZZ7E=; b=bAzBYJuc123nRAjXW2cywWYE3+pAbw4FOWNFmkwkaXTB0N0yDHDwdG2527Mr7f5UdtlDSwgOmkaE5YMAdpbWSVte7fNFYz6YR7tnyMc/+Es688is1KrvGCYmISfMvs/UMidXqHX6WtWoC0WwKU9qOCGfgIAsqN4y0Bcn/S6i+iuQVzgF7wEzXQUrwTX0q30il3PORHmVFIYa2Sg58bqUz3c/JDBOYJNcCv8F3sFP6YuVjDgOrbil8xBcNUFKXIm2svYhJEst2srFV4c+utwEg2hwr8AcN4x4/Es43+EaLB/cojHFJ2brl9Z43JeYcUiSWAbRZtl1I5kvPRy+ol8iuQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ExRP+n2fqvow2rJeu6AJRmetjqioreXASrySF4zEFyfIZye8LhlFMNRuDBx++uPb3mfnWU2bOieP3tgCUa0R87QJ7LRVW1/i0EeQREkYcSKlTr50WVEA6P+PxTKKfGEafxgAxuo+OcFgnEBN0Fafl1zgnRVRF1zxUzA90knIICgC61HtyvimTYEkXcLBDv6C9nOh2D9iHZUUDjE98wl9gXZn/L7tpVh1BTYRws7oD/HFAue0wLx88cfPjeTG9jByd7tZtyBO+STZofxC2fygqjmQU55+deaW0mHY4yRRspmRRjCMqOR8L9RirrhCg1LsNX3LAxCsQNIdHnvLbNqEXg==
- Authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com;
- Cc: jgross@xxxxxxxx, sstabellini@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
- Delivery-date: Wed, 17 Mar 2021 22:32:00 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@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);
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;
> }
|