[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240521191347.413578-3-linan666@huaweicloud.com>
Date: Wed, 22 May 2024 03:13:47 +0800
From: linan666@...weicloud.com
To: richard@....at,
miquel.raynal@...tlin.com,
vigneshr@...com,
axboe@...nel.dk,
chaitanya.kulkarni@....com
Cc: linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org,
chengzhihao1@...wei.com,
linan666@...weicloud.com,
yukuai3@...wei.com,
yi.zhang@...wei.com,
houtao1@...wei.com,
yangerkun@...wei.com
Subject: [PATCH v2 2/2] ubi: block: improve error log before setting dev_name in ubiblock_create()
From: Li Nan <linan122@...wei.com>
dev_err() outputs dev_name using 'kobject_name(&dev->kobj)' to notify
users about the device encountering an error. However, before initializing
device name, it will print error message with 'null' instead of the actual
device name, like this:
block (null): ...
~~~~~~
This log is not clear enough to provide the necessary context for
identifying the device. Therefore, in the error handling path of
blk_mq_alloc_tag_set() and idr_alloc(), where device name has not been
init yet, using pr_err() instead of dev_err() to print more details.
The improved error log is:
ubiblock0_0: ...
Signed-off-by: Li Nan <linan122@...wei.com>
---
drivers/mtd/ubi/block.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 3b61196d387b..bf7308e8ec2f 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -390,7 +390,8 @@ int ubiblock_create(struct ubi_volume_info *vi)
ret = blk_mq_alloc_tag_set(&dev->tag_set);
if (ret) {
- dev_err(disk_to_dev(gd), "blk_mq_alloc_tag_set failed");
+ pr_err("ubiblock%d_%d: blk_mq_alloc_tag_set failed\n",
+ dev->ubi_num, dev->vol_id);
goto out_free_dev;
}
@@ -407,8 +408,8 @@ int ubiblock_create(struct ubi_volume_info *vi)
gd->minors = 1;
gd->first_minor = idr_alloc(&ubiblock_minor_idr, dev, 0, 0, GFP_KERNEL);
if (gd->first_minor < 0) {
- dev_err(disk_to_dev(gd),
- "block: dynamic minor allocation failed");
+ pr_err("ubiblock%d_%d: block: dynamic minor allocation failed\n",
+ dev->ubi_num, dev->vol_id);
ret = -ENODEV;
goto out_cleanup_disk;
}
--
2.39.2
Powered by blists - more mailing lists