From 9cf1b030a269e3a9e6e5ad9aaf373f104e9b1580 Mon Sep 17 00:00:00 2001 From: Georgi Djakov Date: Fri, 11 Sep 2015 16:26:31 +0300 Subject: [PATCH] power: avs: cpr: Fix Duplicate OPPs warning Change the sequence to get the regulators first and then add OPPs as regulators can defer probe in the middle and leave us with only partially added OPPs. Signed-off-by: Georgi Djakov --- drivers/power/avs/qcom-cpr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/power/avs/qcom-cpr.c b/drivers/power/avs/qcom-cpr.c index fd4552f9f2f7..6c77b922d995 100644 --- a/drivers/power/avs/qcom-cpr.c +++ b/drivers/power/avs/qcom-cpr.c @@ -1279,14 +1279,6 @@ static int cpr_populate_opps(struct device_node *of_node, struct cpr_drv *drv, if (!cpu_dev) return -EINVAL; - for (j = 0, corner = drv->corners; plan[j]; j++, corner++) { - p = plan[j]; - ret = dev_pm_opp_add(cpu_dev, p->freq, corner->uV); - if (ret) - return ret; - corner->freq = p->freq; - } - /* * Keep cpu_dev and its regulator and clock for monitoring * voltage changes and updating OPPs later. @@ -1300,6 +1292,14 @@ static int cpr_populate_opps(struct device_node *of_node, struct cpr_drv *drv, if (IS_ERR(drv->cpu_clk)) return PTR_ERR(drv->cpu_clk); } + + for (j = 0, corner = drv->corners; plan[j]; j++, corner++) { + p = plan[j]; + ret = dev_pm_opp_add(cpu_dev, p->freq, corner->uV); + if (ret) + return ret; + corner->freq = p->freq; + } } return 0; -- 2.39.2