diff mbox

opp: set new_opp->dev_opp to a valid dev_opp

Message ID 92ee61e091ccc336e6937f7af093f7ce569f5485.1418104004.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Dec. 9, 2014, 5:48 a.m. UTC
We find/allocate dev_opp after using its value to fill new_opp->dev_opp right
now. Move this to a later point where dev_opp is valid.

Fixes: a7470db6fec4 ("PM / OPP don't match for existing OPPs when list is empty")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/base/power/opp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 2d195f3a1998..c2020520b2bf 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -400,7 +400,6 @@  static int dev_pm_opp_add_dynamic(struct device *dev, unsigned long freq,
 	mutex_lock(&dev_opp_list_lock);
 
 	/* populate the opp table */
-	new_opp->dev_opp = dev_opp;
 	new_opp->rate = freq;
 	new_opp->u_volt = u_volt;
 	new_opp->available = true;
@@ -460,6 +459,7 @@  static int dev_pm_opp_add_dynamic(struct device *dev, unsigned long freq,
 	}
 
 list_add:
+	new_opp->dev_opp = dev_opp;
 	list_add_rcu(&new_opp->node, head);
 	mutex_unlock(&dev_opp_list_lock);