* [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message
@ 2026-10-31 14:17 shao.mingyin
2026-11-03 5:05 ` Damien Le Moal
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: shao.mingyin @ 2026-10-31 14:17 UTC (permalink / raw)
To: dlemoal, hch, linux-block; +Cc: axboe, linux-kernel
From: Shao Mingyin <shao.mingyin@zte.com.cn>
When blk_mq_alloc_disk() fails, "ret" still holds the zero returned by the
preceding blk_mq_alloc_tag_set() call, so the error message always reports
"err=0". Save PTR_ERR(zlo->disk) in "ret" before printing it, like the
blk_mq_alloc_tag_set() and add_disk() failure paths do.
Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index 9145e0f98d56..b7cfd5a39f16 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -1343,8 +1343,8 @@ static int zloop_ctl_add(struct zloop_options *opts)
zlo->disk = blk_mq_alloc_disk(&zlo->tag_set, &lim, zlo);
if (IS_ERR(zlo->disk)) {
- pr_err("blk_mq_alloc_disk failed (err=%d)\n", ret);
ret = PTR_ERR(zlo->disk);
+ pr_err("blk_mq_alloc_disk failed (err=%d)\n", ret);
goto out_cleanup_tags;
}
zlo->disk->flags = GENHD_FL_NO_PART;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message
2026-10-31 14:17 [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message shao.mingyin
@ 2026-11-03 5:05 ` Damien Le Moal
2026-11-03 5:30 ` Christoph Hellwig
2026-11-03 14:31 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2026-11-03 5:05 UTC (permalink / raw)
To: shao.mingyin, hch, linux-block; +Cc: axboe, linux-kernel
On 10/31/26 23:17, shao.mingyin@zte.com.cn wrote:
> From: Shao Mingyin <shao.mingyin@zte.com.cn>
>
> When blk_mq_alloc_disk() fails, "ret" still holds the zero returned by the
> preceding blk_mq_alloc_tag_set() call, so the error message always reports
> "err=0". Save PTR_ERR(zlo->disk) in "ret" before printing it, like the
> blk_mq_alloc_tag_set() and add_disk() failure paths do.
>
> Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message
2026-10-31 14:17 [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message shao.mingyin
2026-11-03 5:05 ` Damien Le Moal
@ 2026-11-03 5:30 ` Christoph Hellwig
2026-11-03 14:31 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2026-11-03 5:30 UTC (permalink / raw)
To: shao.mingyin; +Cc: dlemoal, hch, linux-block, axboe, linux-kernel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message
2026-10-31 14:17 [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message shao.mingyin
2026-11-03 5:05 ` Damien Le Moal
2026-11-03 5:30 ` Christoph Hellwig
@ 2026-11-03 14:31 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2026-11-03 14:31 UTC (permalink / raw)
To: dlemoal, hch, linux-block, shao.mingyin; +Cc: linux-kernel
On Sat, 31 Oct 2026 22:17:37 +0800, shao.mingyin@zte.com.cn wrote:
> When blk_mq_alloc_disk() fails, "ret" still holds the zero returned by the
> preceding blk_mq_alloc_tag_set() call, so the error message always reports
> "err=0". Save PTR_ERR(zlo->disk) in "ret" before printing it, like the
> blk_mq_alloc_tag_set() and add_disk() failure paths do.
Applied, thanks!
[1/1] zloop: fix the error code in the blk_mq_alloc_disk message
commit: 703f6aee8d8d1cb6227af56169be6b1dc4d3c4d5
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-03 14:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 14:17 [PATCH] zloop: fix the error code in the blk_mq_alloc_disk message shao.mingyin
2026-11-03 5:05 ` Damien Le Moal
2026-11-03 5:30 ` Christoph Hellwig
2026-11-03 14:31 ` Jens Axboe
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®