linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-mq:Use BUG_ON instead of if condition followed by BUG.
@ 2021-11-11 10:37 cgel.zte
  2021-11-12  6:35 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-11 10:37 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Zhang Mingyu, Zeal Robot

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)));
 	__blk_mq_end_request(rq, error);
 }
 EXPORT_SYMBOL(blk_mq_end_request);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] blk-mq:Use BUG_ON instead of if condition followed by BUG.
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-11-12  6:35 UTC (permalink / raw)
  To: cgel.zte; +Cc: axboe, linux-block, linux-kernel, Zhang Mingyu, Zeal Robot

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-12  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).