[PATCH v2] mtd: Avoid printing error messages on probe deferrals

Miquel Raynal miquel.raynal at bootlin.com
Mon Mar 20 04:23:21 PDT 2023


Hi Rafał,

zajec5 at gmail.com wrote on Mon, 20 Mar 2023 12:17:12 +0100:

> On 7.03.2023 20:25, Miquel Raynal wrote:
> > There is no reason to complain about probe errors in case of deferrals.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
> > ---
> > Changes in v2:
> > * Use of dev_err_probe().
> > 
> >   drivers/mtd/mtdcore.c | 9 ++++-----
> >   1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> > index 0feacb9fbdac..e4e102585021 100644
> > --- a/drivers/mtd/mtdcore.c
> > +++ b/drivers/mtd/mtdcore.c
> > @@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
> >   	mtd->nvmem = nvmem_register(&config);
> >   	if (IS_ERR(mtd->nvmem)) {
> >   		/* Just ignore if there is no NVMEM support in the kernel */
> > -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
> > +		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
> >   			mtd->nvmem = NULL;
> > -		} else {
> > -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
> > -			return PTR_ERR(mtd->nvmem);
> > -		}
> > +		else
> > +			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),
> > +					     "Failed to register NVMEM device\n");  
> 
> Even one more improvement request possibility and request from me:
> "Failed to register NVMEM device: %d\n"

I get the request, but as I was saying in the other thread, isn't this
already handled?

https://elixir.bootlin.com/linux/latest/source/drivers/base/core.c#L4961

Thanks,
Miquèl



More information about the linux-mtd mailing list