[PATCH 07/13] opp: Allow _generic_set_opp_clk_only() to work for non-freq devices
Viresh Kumar
viresh.kumar at linaro.org
Thu Jan 21 06:17:47 EST 2021
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 at linaro.org>
---
drivers/opp/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index a96ffd9051b1..6b09d468d37a 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 (unlikely(!clk))
+ return 0;
+
ret = clk_set_rate(clk, freq);
if (ret) {
dev_err(dev, "%s: failed to set clock rate: %d\n", __func__,
--
2.25.0.rc1.19.g042ed3e048af
More information about the linux-arm-kernel
mailing list