summaryrefslogtreecommitdiff
path: root/drivers/opp
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2021-01-29 16:12:04 +0530
committerViresh Kumar <viresh.kumar@linaro.org>2021-02-02 10:30:53 +0530
commitd4a4c7a41153d701f23322ea5d39c766e9ff6eee (patch)
tree34a9173a10273773ed8830cc733900b68f7276dc /drivers/opp
parent870d5d963972ddefa83a09a7dbe4bef01f0b35b8 (diff)
downloadlinux-d4a4c7a41153d701f23322ea5d39c766e9ff6eee.tar.gz
opp: Don't ignore clk_get() errors other than -ENOENT
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> Tested-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/opp')
-rw-r--r--drivers/opp/core.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index a518173fd64a..dc95d29e94c1 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,20 @@ 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);
+ dev_err_probe(dev, ret, "Couldn't find clock\n");
+
+ return ERR_PTR(ret);
}
/*