linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: kjlu@umn.edu, pakki001@umn.edu,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] base: fix a missing check of clk_prepare
Date: Mon, 31 Dec 2018 18:25:56 +0100	[thread overview]
Message-ID: <20181231172556.GA14092@amd> (raw)
In-Reply-To: <CAJZ5v0iK+ASbadEjj+9vgCV+1ycjp8Hs2GbEmT3dGSqjLVGbPA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

On Wed 2018-12-26 10:37:54, Rafael J. Wysocki wrote:
> On Wed, Dec 26, 2018 at 3:47 AM Kangjie Lu <kjlu@umn.edu> wrote:
> >
> > clk_prepare() could fail, so let's check its status, and if it fails,
> > issue an error message.
> >
> > Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> > ---
> >  drivers/base/power/clock_ops.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
> > index 5a42ae4078c2..cb6144fb24e2 100644
> > --- a/drivers/base/power/clock_ops.c
> > +++ b/drivers/base/power/clock_ops.c
> > @@ -65,7 +65,9 @@ static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce)
> >         if (IS_ERR(ce->clk)) {
> >                 ce->status = PCE_STATUS_ERROR;
> >         } else {
> > -               clk_prepare(ce->clk);
> > +               if (clk_prepare(ce->clk))
> > +                       dev_err(dev, "clk_prepare failed.\n");
> 
> I'm not sure that this is useful.  The code continues regardless of
> the error anyway and it should at least set ce->status to
> PCE_STATUS_ERROR in the failing case.

Maybe this is not complete fix, but dev_err() is preferable to silent
failure.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2018-12-31 17:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26  2:47 [PATCH] base: fix a missing check of clk_prepare Kangjie Lu
2018-12-26  9:37 ` Rafael J. Wysocki
2018-12-31 17:25   ` Pavel Machek [this message]
2019-01-01 20:13     ` Rafael J. Wysocki
2019-01-01 20:21       ` Pavel Machek
2019-01-01 21:05         ` Rafael J. Wysocki
2019-02-11 13:24           ` Pavel Machek

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=20181231172556.GA14092@amd \
    --to=pavel@ucw.cz \
    --cc=gregkh@linuxfoundation.org \
    --cc=kjlu@umn.edu \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).