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
  2026-11-03  5:30 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2026-11-03  5:30 UTC | newest]

Thread overview: 3+ 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

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®