aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq-cpu0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq-cpu0.c')
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c9
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,
69 69
70 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); 70 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
71 71
72 if (cpu_reg) { 72 if (!IS_ERR(cpu_reg)) {
73 rcu_read_lock(); 73 rcu_read_lock();
74 opp = opp_find_freq_ceil(cpu_dev, &freq_Hz); 74 opp = opp_find_freq_ceil(cpu_dev, &freq_Hz);
75 if (IS_ERR(opp)) { 75 if (IS_ERR(opp)) {
@@ -90,7 +90,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
90 freqs.new / 1000, volt ? volt / 1000 : -1); 90 freqs.new / 1000, volt ? volt / 1000 : -1);
91 91
92 /* scaling up? scale voltage before frequency */ 92 /* scaling up? scale voltage before frequency */
93 if (cpu_reg && freqs.new > freqs.old) { 93 if (!IS_ERR(cpu_reg) && freqs.new > freqs.old) {
94 ret = regulator_set_voltage_tol(cpu_reg, volt, tol); 94 ret = regulator_set_voltage_tol(cpu_reg, volt, tol);
95 if (ret) { 95 if (ret) {
96 pr_err("failed to scale voltage up: %d\n", ret); 96 pr_err("failed to scale voltage up: %d\n", ret);
@@ -102,14 +102,14 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
102 ret = clk_set_rate(cpu_clk, freq_exact); 102 ret = clk_set_rate(cpu_clk, freq_exact);
103 if (ret) { 103 if (ret) {
104 pr_err("failed to set clock rate: %d\n", ret); 104 pr_err("failed to set clock rate: %d\n", ret);
105 if (cpu_reg) 105 if (!IS_ERR(cpu_reg))
106 regulator_set_voltage_tol(cpu_reg, volt_old, tol); 106 regulator_set_voltage_tol(cpu_reg, volt_old, tol);
107 freqs.new = freqs.old; 107 freqs.new = freqs.old;
108 goto post_notify; 108 goto post_notify;
109 } 109 }
110 110
111 /* scaling down? scale voltage after frequency */ 111 /* scaling down? scale voltage after frequency */
112 if (cpu_reg && freqs.new < freqs.old) { 112 if (!IS_ERR(cpu_reg) && freqs.new < freqs.old) {
113 ret = regulator_set_voltage_tol(cpu_reg, volt, tol); 113 ret = regulator_set_voltage_tol(cpu_reg, volt, tol);
114 if (ret) { 114 if (ret) {
115 pr_err("failed to scale voltage down: %d\n", ret); 115 pr_err("failed to scale voltage down: %d\n", ret);
@@ -210,7 +210,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
210 } 210 }
211 pr_warn("failed to get cpu0 regulator: %ld\n", 211 pr_warn("failed to get cpu0 regulator: %ld\n",
212 PTR_ERR(cpu_reg)); 212 PTR_ERR(cpu_reg));
213 cpu_reg = NULL;
214 } 213 }
215 214
216 cpu_clk = devm_clk_get(cpu_dev, NULL); 215 cpu_clk = devm_clk_get(cpu_dev, NULL);