From: Dmitry Osipenko <digetx@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
Rafael Wysocki <rjw@rjwysocki.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] opp: Don't ignore clk_get() errors other than -ENOENT
Date: Mon, 1 Feb 2021 22:54:45 +0300 [thread overview]
Message-ID: <e6523427-0484-18c3-5b66-a35146556bab@gmail.com> (raw)
In-Reply-To: <61854037cd4d3ac367cfda3f02fd1557b1b3bb8b.1612153322.git.viresh.kumar@linaro.org>
01.02.2021 07:22, Viresh Kumar пишет:
> Not all devices that need to use OPP core need to have clocks, a missing
> clock is fine in which case -ENOENT shall be returned by clk_get().
>
> Anything else is an error and must be handled properly.
>
> Reported-by: Dmitry Osipenko <digetx@gmail.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> V2:
> - s/ENODEV/ENOENT
> - Use dev_err_probe()
>
> Stephen, is the understanding correct that -ENOENT is the only error
> returned for missing clocks ?
>
> drivers/opp/core.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index a518173fd64a..0beb3ee79523 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1252,6 +1252,8 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
> struct opp_table *opp_table,
> bool getclk)
> {
> + int ret;
> +
> /*
> * Return early if we don't need to get clk or we have already tried it
> * earlier.
> @@ -1261,18 +1263,19 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
>
> /* Find clk for the device */
> opp_table->clk = clk_get(dev, NULL);
> - if (IS_ERR(opp_table->clk)) {
> - int ret = PTR_ERR(opp_table->clk);
>
> - if (ret == -EPROBE_DEFER) {
> - dev_pm_opp_put_opp_table(opp_table);
> - return ERR_PTR(ret);
> - }
> + ret = PTR_ERR_OR_ZERO(opp_table->clk);
> + if (!ret)
> + return opp_table;
>
> + if (ret == -ENOENT) {
> dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret);
> + return opp_table;
> }
>
> - return opp_table;
> + dev_pm_opp_put_opp_table(opp_table);
> +
> + return ERR_PTR(dev_err_probe(dev, ret, "Couldn't find clock\n"));
> }
>
> /*
>
Thanks, looks okay.
Although, I think the previous variant of coding style was a bit more appropriate, i.e. like this:
dev_err_probe(dev, "%s: Couldn't find clock: %d\n", __func__, ret);
return ERR_PTR(ret);
next prev parent reply other threads:[~2021-02-01 19:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 4:22 Viresh Kumar
2021-02-01 19:54 ` Dmitry Osipenko [this message]
2021-02-02 4:35 ` Viresh Kumar
2021-02-11 19:19 ` Stephen Boyd
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=e6523427-0484-18c3-5b66-a35146556bab@gmail.com \
--to=digetx@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=vireshk@kernel.org \
/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
all inboxes | Powered by JetHome®