summaryrefslogtreecommitdiff
path: root/drivers/opp
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2021-01-21 10:08:13 +0300
committerViresh Kumar <viresh.kumar@linaro.org>2021-02-02 07:58:01 +0300
commit35e74b2ee8ec64da6f8067c5b0744f16ff19915b (patch)
treef30361ba135c03a55b1f2f652b1f27778b0ccdb2 /drivers/opp
parent3f62670fcca4af3fe6492100a548603831ecc61d (diff)
downloadlinux-35e74b2ee8ec64da6f8067c5b0744f16ff19915b.tar.xz
opp: Allow _generic_set_opp_clk_only() to work for non-freq devices
In order to avoid conditional statements at the caller site, this patch updates _generic_set_opp_clk_only() to work for devices that don't change frequency (like power domains, etc.). Return 0 if the clk pointer passed to this routine is not valid. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Dmitry Osipenko <digetx@gmail.com>
Diffstat (limited to 'drivers/opp')
-rw-r--r--drivers/opp/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index c078c7dab6b2..f21ce52a5002 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -726,6 +726,10 @@ static inline int _generic_set_opp_clk_only(struct device *dev, struct clk *clk,
{
int ret;
+ /* We may reach here for devices which don't change frequency */
+ if (IS_ERR(clk))
+ return 0;
+
ret = clk_set_rate(clk, freq);
if (ret) {
dev_err(dev, "%s: failed to set clock rate: %d\n", __func__,