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

Rafał Miłecki zajec5 at gmail.com
Mon Mar 20 04:21:47 PDT 2023


On 20.03.2023 12:06, Miquel Raynal wrote:
> 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/

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


>> 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);
>>   		}
>>   	}




More information about the linux-mtd mailing list