blk-mq:Use BUG_ON instead of if condition followed by BUG.
PATCH 1/1 blk-mq:Use BUG_ON instead of if condition followed by BUG.
From: Zhang Mingyu <[email protected]>
This issue was detected with the help of Coccinelle.
Reported-by Zeal Robot <[email protected]>
Signed-off-by Zhang Mingyu <[email protected]>
--- block/blk-mq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/blk-mq.c +1 -2
@@ -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);
Signature · 1 line
2.25.1
Quoted 15 lines · On Thu, Nov 11, 2021 at 10:37:22AM +0000, [email protected] wrote:
From: Zhang Mingyu <[email protected]>
This issue was detected with the help of Coccinelle.
Reported-by Zeal Robot <[email protected]>Signed-off-by Zhang Mingyu <[email protected]>--- block/blk-mq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)block/blk-mq.c +0
-0
block/blk-mq.c EXPORT_SYMBOL(__blk_mq_end_request); · line 821
Quoted 6 lines
block/blk-mq.c +1
-2@@ -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.