public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: cgel.zte@gmail.com
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Zhang Mingyu <zhang.mingyu@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] blk-mq:Use BUG_ON instead of if condition followed by BUG.
Date: Thu, 11 Nov 2021 22:35:12 -0800	[thread overview]
Message-ID: <YY4LILztrgdH5tiU@infradead.org> (raw)
In-Reply-To: <20211111103722.1650-1-zhang.mingyu@zte.com.cn>

On Thu, Nov 11, 2021 at 10:37:22AM +0000, cgel.zte@gmail.com wrote:
> From: Zhang Mingyu <zhang.mingyu@zte.com.cn>
> 
> This issue was detected with the help of Coccinelle.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Zhang Mingyu <zhang.mingyu@zte.com.cn>
> ---
>  block/blk-mq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 7c5c8a26c8fc..05bffbc6b8ff 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -818,8 +818,7 @@ EXPORT_SYMBOL(__blk_mq_end_request);
>  
>  void blk_mq_end_request(struct request *rq, blk_status_t error)
>  {
> -	if (blk_update_request(rq, error, blk_rq_bytes(rq)))
> -		BUG();
> +	BUG_ON(blk_update_request(rq, error, blk_rq_bytes(rq)));

Err, no.  This now moves the actually important condition into the
BUG_ON macro and makes the function a complete mess.

      reply	other threads:[~2021-11-12  6:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 10:37 [PATCH] blk-mq:Use BUG_ON instead of if condition followed by BUG cgel.zte
2021-11-12  6:35 ` Christoph Hellwig [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=YY4LILztrgdH5tiU@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=cgel.zte@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zealci@zte.com.cn \
    --cc=zhang.mingyu@zte.com.cn \
    /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