All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: core: print error code if registering NVMEM fails
@ 2023-03-17  7:47 Rafał Miłecki
  2023-03-20 11:06 ` Miquel Raynal
  0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2023-03-17  7:47 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: linux-mtd, Rafał Miłecki

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

It's a common practice that helps debugging problems.

Signed-off-by: Rafał Miłecki <rafal@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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: core: print error code if registering NVMEM fails
  2023-03-17  7:47 [PATCH] mtd: core: print error code if registering NVMEM fails Rafał Miłecki
@ 2023-03-20 11:06 ` Miquel Raynal
  2023-03-20 11:21   ` Rafał Miłecki
  0 siblings, 1 reply; 3+ messages in thread
From: Miquel Raynal @ 2023-03-20 11:06 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Richard Weinberger, Vignesh Raghavendra, linux-mtd,
	Rafał Miłecki

Hi Rafał,

zajec5@gmail.com wrote on Fri, 17 Mar 2023 08:47:36 +0100:

> From: Rafał Miłecki <rafal@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@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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: core: print error code if registering NVMEM fails
  2023-03-20 11:06 ` Miquel Raynal
@ 2023-03-20 11:21   ` Rafał Miłecki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2023-03-20 11:21 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Vignesh Raghavendra, linux-mtd,
	Rafał Miłecki

On 20.03.2023 12:06, Miquel Raynal wrote:
> zajec5@gmail.com wrote on Fri, 17 Mar 2023 08:47:36 +0100:
> 
>> From: Rafał Miłecki <rafal@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/

I see, thanks, we can drop this (my) patch.


>> Signed-off-by: Rafał Miłecki <rafal@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);
>>   		}
>>   	}


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-20 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  7:47 [PATCH] mtd: core: print error code if registering NVMEM fails Rafał Miłecki
2023-03-20 11:06 ` Miquel Raynal
2023-03-20 11:21   ` Rafał Miłecki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.