mtd: core: print error code if registering NVMEM fails
PATCH 1/1 mtd: core: print error code if registering NVMEM fails
From: Rafał Miłecki <[email protected]>
It's a common practice that helps debugging problems.
--- drivers/mtd/mtdcore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/mtdcore.c +2 -1
@@ -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); } }
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerHi Rafał,
[email protected] wrote on Fri, 17 Mar 2023 08:47:36 +0100:
Quoted 3 lines
From: Rafał Miłecki <[email protected]>
It's a common practice that helps debugging problems.
Totally agree. I actually sent a patch to avoid the error message upon EPROBE_DEFER which has the side effect of printing the error (thanks to the use of dev_err_probe()):
https://lore.kernel.org/linux-mtd/[email protected]/
Quoted 10 lines
Signed-off-by Rafał Miłecki <[email protected]>--- drivers/mtd/mtdcore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mtd/mtdcore.c +0
-0
drivers/mtd/mtdcore.c static int mtd_nvmem_add(struct mtd_info *mtd) · line 546
Quoted 9 lines
drivers/mtd/mtdcore.c +2
-1@@ -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); } }
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 11 lines · Miquel Raynal
[email protected] wrote on Fri, 17 Mar 2023 08:47:36 +0100:
Quoted 3 lines
From: Rafał Miłecki <[email protected]>
It's a common practice that helps debugging problems.
Totally agree. I actually sent a patch to avoid the error message upon
EPROBE_DEFERwhich has the side effect of printing the error (thanks to the use ofdev_err_probe()):
I see, thanks, we can drop this (my) patch.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Rafał Miłecki <[email protected]>--- drivers/mtd/mtdcore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 14 lines
Quoted 5 lines
drivers/mtd/mtdcore.c +0
-0drivers/mtd/mtdcore.c static int mtd_nvmem_add(struct mtd_info *mtd) · line 546
Quoted 9 lines
drivers/mtd/mtdcore.c +2
-1@@ -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); } }
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/