diff options
author | Mark Brown <broonie@linaro.org> | 2013-08-13 14:58:24 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-14 22:24:22 +0200 |
commit | 4a511de96d692f2dfa126c10dda4e41636c0ef27 (patch) | |
tree | 20ddaa54c87e088d2eadc3600ea4ebd5bbe7383b /drivers/cpufreq | |
parent | 59027d356666a2c1d576baacb98de9fb30e4c48e (diff) | |
download | talos-obmc-linux-4a511de96d692f2dfa126c10dda4e41636c0ef27.tar.gz talos-obmc-linux-4a511de96d692f2dfa126c10dda4e41636c0ef27.zip |
cpufreq: cpufreq-cpu0: NULL is a valid regulator
Since NULL could in theory be a valid regulator we ought to check for
IS_ERR() rather than for NULL. In practice this is unlikely to be an
issue but it's better for neatness.
Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq-cpu0.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index ad1fde277661..09cd3a76fb2e 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -69,7 +69,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); - if (cpu_reg) { + if (!IS_ERR(cpu_reg)) { rcu_read_lock(); opp = opp_find_freq_ceil(cpu_dev, &freq_Hz); if (IS_ERR(opp)) { @@ -90,7 +90,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, freqs.new / 1000, volt ? volt / 1000 : -1); /* scaling up? scale voltage before frequency */ - if (cpu_reg && freqs.new > freqs.old) { + if (!IS_ERR(cpu_reg) && freqs.new > freqs.old) { ret = regulator_set_voltage_tol(cpu_reg, volt, tol); if (ret) { pr_err("failed to scale voltage up: %d\n", ret); @@ -102,14 +102,14 @@ static int cpu0_set_target(struct cpufreq_policy *policy, ret = clk_set_rate(cpu_clk, freq_exact); if (ret) { pr_err("failed to set clock rate: %d\n", ret); - if (cpu_reg) + if (!IS_ERR(cpu_reg)) regulator_set_voltage_tol(cpu_reg, volt_old, tol); freqs.new = freqs.old; goto post_notify; } /* scaling down? scale voltage after frequency */ - if (cpu_reg && freqs.new < freqs.old) { + if (!IS_ERR(cpu_reg) && freqs.new < freqs.old) { ret = regulator_set_voltage_tol(cpu_reg, volt, tol); if (ret) { pr_err("failed to scale voltage down: %d\n", ret); @@ -210,7 +210,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) } pr_warn("failed to get cpu0 regulator: %ld\n", PTR_ERR(cpu_reg)); - cpu_reg = NULL; } cpu_clk = devm_clk_get(cpu_dev, NULL); |