Skip to content

Commit

Permalink
opp: Allow _generic_set_opp_clk_only() to work for non-freq devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Viresh Kumar committed Feb 2, 2021
1 parent 3f62670 commit 35e74b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/opp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__,
Expand Down

0 comments on commit 35e74b2

Please sign in to comment.