[PATCH] genhd: register_disk: inform about dev_set_name() failure
From: Eugene Korenevsky
Date: Sat Jul 21 2018 - 18:28:58 EST
Although dev_set_name() failure is not fatal, it is better to print
a warning message into dmesg about it.
Signed-off-by: Eugene Korenevsky <ekorenevsky@xxxxxxxxx>
---
block/genhd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/genhd.c b/block/genhd.c
index f1543a45e73b..071f8cbd529a 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -577,7 +577,9 @@ static void register_disk(struct device *parent, struct gendisk *disk)
ddev->parent = parent;
- dev_set_name(ddev, "%s", disk->disk_name);
+ err = dev_set_name(ddev, "%s", disk->disk_name);
+ if (err)
+ pr_warn("%s: cannot set disk name: %d", __func__, err);
/* delay uevents, until we scanned partition table */
dev_set_uevent_suppress(ddev, 1);
--
2.18.0