[PATCH] mtd: core: print error code if registering NVMEM fails

Rafał Miłecki zajec5 at gmail.com
Fri Mar 17 00:47:36 PDT 2023


From: Rafał Miłecki <rafal at milecki.pl>

It's a common practice that helps debugging problems.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 drivers/mtd/mtdcore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 83a22566a8ce..8303ce62c751 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -539,7 +539,8 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
 		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
 			mtd->nvmem = NULL;
 		} else {
-			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
+			dev_err(&mtd->dev, "Failed to register NVMEM device: %ld\n",
+				PTR_ERR(mtd->nvmem));
 			return PTR_ERR(mtd->nvmem);
 		}
 	}
-- 
2.34.1




More information about the linux-mtd mailing list