summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq-dt.c
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2014-10-18 00:09:49 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-11-06 01:28:59 +0100
commit8197bb1bffbee6a7678d20b4c1e77940cdaa8640 (patch)
tree88b21606bdd410f7ed4e3498f71e177e6039131e /drivers/cpufreq/cpufreq-dt.c
parentcpufreq: cpufreq-dt: Improve debug about matching OPP (diff)
downloadlinux-8197bb1bffbee6a7678d20b4c1e77940cdaa8640.tar.xz
linux-8197bb1bffbee6a7678d20b4c1e77940cdaa8640.zip
cpufreq: cpufreq-dt: Handle regulator_get_voltage() failure
In error cases regulator_get_voltage() returns a negative value. So take care of it. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq-dt.c')
-rw-r--r--drivers/cpufreq/cpufreq-dt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 725fb1d86578..8cba13df5f28 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -78,7 +78,7 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
}
dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",
- old_freq / 1000, volt_old ? volt_old / 1000 : -1,
+ old_freq / 1000, (volt_old > 0) ? volt_old / 1000 : -1,
new_freq / 1000, volt ? volt / 1000 : -1);
/* scaling up? scale voltage before frequency */
@@ -94,7 +94,7 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
ret = clk_set_rate(cpu_clk, freq_exact);
if (ret) {
dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
- if (!IS_ERR(cpu_reg))
+ if (!IS_ERR(cpu_reg) && volt_old > 0)
regulator_set_voltage_tol(cpu_reg, volt_old, tol);
return ret;
}