From: Viresh Kumar Date: Thu, 21 Jan 2021 07:08:13 +0000 (+0530) Subject: opp: Allow _generic_set_opp_clk_only() to work for non-freq devices X-Git-Tag: accepted/tizen/unified/20230118.172025~7760^2^3~1^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35e74b2ee8ec64da6f8067c5b0744f16ff19915b;p=platform%2Fkernel%2Flinux-rpi.git 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 Tested-by: Dmitry Osipenko --- diff --git a/drivers/opp/core.c b/drivers/opp/core.c index c078c7d..f21ce52a 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__,