public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Michael Walle <michael@walle.cc>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <tudor.ambarus@linaro.org>,
	Pratyush Yadav <pratyush@kernel.org>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] mtd: Avoid printing error messages on probe deferrals
Date: Mon, 6 Mar 2023 14:36:41 +0100	[thread overview]
Message-ID: <20230306143641.3bfe09ee@xps-13> (raw)
In-Reply-To: <7a9d652112b2619e3aaa4afd0e24d0ce@walle.cc>

Hi Michael,

michael@walle.cc wrote on Mon, 06 Mar 2023 14:10:22 +0100:

> Am 2023-03-01 16:24, schrieb Miquel Raynal:
> > There is no reason to complain about probe errors in case of deferrals.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/mtd/mtdcore.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> > index 0feacb9fbdac..d163c690750a 100644
> > --- a/drivers/mtd/mtdcore.c
> > +++ b/drivers/mtd/mtdcore.c
> > @@ -518,6 +518,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
> >  {
> >  	struct device_node *node = mtd_get_of_node(mtd);
> >  	struct nvmem_config config = {};
> > +	int ret;
> > 
> >  	config.id = -1;  
> 
> just noticed that magic value. If you care replace it with NVMEM_DEVID_NONE.

Mmmh yeah.

> 
> >  	config.dev = &mtd->dev;
> > @@ -535,12 +536,15 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
> > 
> >  	mtd->nvmem = nvmem_register(&config);
> >  	if (IS_ERR(mtd->nvmem)) {
> > +		ret = PTR_ERR(mtd->nvmem);
> >  		/* Just ignore if there is no NVMEM support in the kernel */
> > -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
> > +		if (ret == -EOPNOTSUPP) {
> >  			mtd->nvmem = NULL;
> >  		} else {
> > -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
> > -			return PTR_ERR(mtd->nvmem);
> > +			if (ret != -EPROBE_DEFER)  
> 
> Since you have a proper "struct device" to operate on, you can also use
> dev_err_probe() which the same but also save the reason for the deferral.

Good point. I'll update, that will make things clearer.

> -michael
> 
> > +				dev_err(&mtd->dev,
> > +					"Failed to register NVMEM device (%d)\n", ret);
> > +			return ret;
> >  		}
> >  	}  

Thanks,
Miquèl

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

      reply	other threads:[~2023-03-06 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 15:24 [PATCH] mtd: Avoid printing error messages on probe deferrals Miquel Raynal
2023-03-06 13:10 ` Michael Walle
2023-03-06 13:36   ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230306143641.3bfe09ee@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox