aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2011-05-26 22:39:19 -0400
committerKevin Hilman <khilman@ti.com>2011-11-08 14:42:17 -0500
commit11e04fdd98f0fd6edf1ad6eccb0db4d2f965c392 (patch)
treecf78535baad8595839eb5da9a3a30b0d2214365d /drivers/cpufreq
parentffe4f0f115420e3843aa0d8dc1baf31ea5b6fcf2 (diff)
cpufreq: OMAP: put clk if cpu_init failed
Release the mpu_clk in fail paths. Reported-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/omap-cpufreq.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 8f778b9dbb46..8c5419201ac5 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -158,8 +158,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
158 if (IS_ERR(mpu_clk)) 158 if (IS_ERR(mpu_clk))
159 return PTR_ERR(mpu_clk); 159 return PTR_ERR(mpu_clk);
160 160
161 if (policy->cpu >= NR_CPUS) 161 if (policy->cpu >= NR_CPUS) {
162 return -EINVAL; 162 result = -EINVAL;
163 goto fail_ck;
164 }
163 165
164 policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); 166 policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
165 result = opp_init_cpufreq_table(mpu_dev, &freq_table); 167 result = opp_init_cpufreq_table(mpu_dev, &freq_table);
@@ -167,12 +169,14 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
167 if (result) { 169 if (result) {
168 dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", 170 dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
169 __func__, policy->cpu, result); 171 __func__, policy->cpu, result);
170 return result; 172 goto fail_ck;
171 } 173 }
172 174
173 result = cpufreq_frequency_table_cpuinfo(policy, freq_table); 175 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
174 if (!result) 176 if (!result)
175 cpufreq_frequency_table_get_attr(freq_table, policy->cpu); 177 cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
178 else
179 goto fail_ck;
176 180
177 policy->min = policy->cpuinfo.min_freq; 181 policy->min = policy->cpuinfo.min_freq;
178 policy->max = policy->cpuinfo.max_freq; 182 policy->max = policy->cpuinfo.max_freq;
@@ -194,6 +198,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
194 policy->cpuinfo.transition_latency = 300 * 1000; 198 policy->cpuinfo.transition_latency = 300 * 1000;
195 199
196 return 0; 200 return 0;
201
202fail_ck:
203 clk_put(mpu_clk);
204 return result;
197} 205}
198 206
199static int omap_cpu_exit(struct cpufreq_policy *policy) 207static int omap_cpu_exit(struct cpufreq_policy *policy)