Commit 7ac62bcd authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

PM / OPP: Don't use OPP structure outside of rcu protected section

commit dc39d06f upstream.

The OPP structure must not be used out of the rcu protected section.
Cache the values to be used in separate variables instead.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Tested-by: default avatarDave Gerlach <d-gerlach@ti.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c7a8a0ac
...@@ -584,6 +584,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) ...@@ -584,6 +584,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
struct clk *clk; struct clk *clk;
unsigned long freq, old_freq; unsigned long freq, old_freq;
unsigned long u_volt, u_volt_min, u_volt_max; unsigned long u_volt, u_volt_min, u_volt_max;
unsigned long old_u_volt, old_u_volt_min, old_u_volt_max;
int ret; int ret;
if (unlikely(!target_freq)) { if (unlikely(!target_freq)) {
...@@ -633,6 +634,14 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) ...@@ -633,6 +634,14 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
return ret; return ret;
} }
if (IS_ERR(old_opp)) {
old_u_volt = 0;
} else {
old_u_volt = old_opp->u_volt;
old_u_volt_min = old_opp->u_volt_min;
old_u_volt_max = old_opp->u_volt_max;
}
u_volt = opp->u_volt; u_volt = opp->u_volt;
u_volt_min = opp->u_volt_min; u_volt_min = opp->u_volt_min;
u_volt_max = opp->u_volt_max; u_volt_max = opp->u_volt_max;
...@@ -677,9 +686,10 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) ...@@ -677,9 +686,10 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
__func__, old_freq); __func__, old_freq);
restore_voltage: restore_voltage:
/* This shouldn't harm even if the voltages weren't updated earlier */ /* This shouldn't harm even if the voltages weren't updated earlier */
if (!IS_ERR(old_opp)) if (old_u_volt) {
_set_opp_voltage(dev, reg, old_opp->u_volt, _set_opp_voltage(dev, reg, old_u_volt, old_u_volt_min,
old_opp->u_volt_min, old_opp->u_volt_max); old_u_volt_max);
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment