mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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

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®