[PATCH] mtd: core: print error code if registering NVMEM fails
Miquel Raynal
miquel.raynal at bootlin.com
Mon Mar 20 04:06:17 PDT 2023
Hi Rafał,
zajec5 at gmail.com wrote on Fri, 17 Mar 2023 08:47:36 +0100:
> From: Rafał Miłecki <rafal at milecki.pl>
>
> 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/20230307192506.439532-1-miquel.raynal@bootlin.com/
> 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);
> }
> }
Thanks,
Miquèl
More information about the linux-mtd
mailing list