public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: stefan@agner.ch, linux-mtd@lists.infradead.org,
	Fabio Estevam <fabio.estevam@nxp.com>
Subject: Re: [PATCH] mtd: nand: vf610: Check the return value from clk_prepare_enable()
Date: Mon, 17 Jul 2017 23:13:54 +0200	[thread overview]
Message-ID: <20170717231354.30550f43@bbrezillon> (raw)
In-Reply-To: <20170717230828.0c8853ca@bbrezillon>

Le Mon, 17 Jul 2017 23:08:28 +0200,
Boris Brezillon <boris.brezillon@free-electrons.com> a écrit :

> Le Mon, 17 Jul 2017 17:55:59 -0300,
> Fabio Estevam <festevam@gmail.com> a écrit :
> 
> > From: Fabio Estevam <fabio.estevam@nxp.com>
> > 
> > clk_prepare_enable() may fail, so we should better check its return value
> > and propagate it in the case of error.
> > 
> > Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> > ---
> >  drivers/mtd/nand/vf610_nfc.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
> > index 744ab10..9e49672 100644
> > --- a/drivers/mtd/nand/vf610_nfc.c
> > +++ b/drivers/mtd/nand/vf610_nfc.c
> > @@ -814,12 +814,16 @@ static int vf610_nfc_suspend(struct device *dev)
> >  
> >  static int vf610_nfc_resume(struct device *dev)
> >  {
> > +	int err;
> > +
> >  	struct mtd_info *mtd = dev_get_drvdata(dev);
> >  	struct vf610_nfc *nfc = mtd_to_nfc(mtd);
> >  
> >  	pinctrl_pm_select_default_state(dev);  
> 
> AFAICT pinctrl_pm_select_default_state() can also fail. What makes it
> different from clk_prepare_enable() failures?
> 
> >  
> > -	clk_prepare_enable(nfc->clk);
> > +	err = clk_prepare_enable(nfc->clk);
> > +	if (err)
> > +		return err;
> >  
> 
> I guess the idea was that clk_prepare_enabled already succeeded at probe
> time and there was not real reason for it to fail at resume time. But
> extra checks are never bad. BTW, I don't remember what happens if
> ->resume() returns an error. Does it prevent the whole system from  
> resuming or just make this specific device unusable?

Just found the answer [1]: it's harmless.

[1]http://elixir.free-electrons.com/linux/latest/source/include/linux/pm.h#L262

  reply	other threads:[~2017-07-17 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 20:55 [PATCH] mtd: nand: vf610: Check the return value from clk_prepare_enable() Fabio Estevam
2017-07-17 21:08 ` Boris Brezillon
2017-07-17 21:13   ` Boris Brezillon [this message]
2017-07-17 21:52   ` Fabio Estevam

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=20170717231354.30550f43@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=fabio.estevam@nxp.com \
    --cc=festevam@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=stefan@agner.ch \
    /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