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>
This commit is contained in:
Nishanth Menon 2011-05-26 19:39:19 -07:00 committed by Kevin Hilman
parent ffe4f0f115
commit 11e04fdd98

View file

@ -158,8 +158,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
if (IS_ERR(mpu_clk)) if (IS_ERR(mpu_clk))
return PTR_ERR(mpu_clk); return PTR_ERR(mpu_clk);
if (policy->cpu >= NR_CPUS) if (policy->cpu >= NR_CPUS) {
return -EINVAL; result = -EINVAL;
goto fail_ck;
}
policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
result = opp_init_cpufreq_table(mpu_dev, &freq_table); result = opp_init_cpufreq_table(mpu_dev, &freq_table);
@ -167,12 +169,14 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
if (result) { if (result) {
dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
__func__, policy->cpu, result); __func__, policy->cpu, result);
return result; goto fail_ck;
} }
result = cpufreq_frequency_table_cpuinfo(policy, freq_table); result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
if (!result) if (!result)
cpufreq_frequency_table_get_attr(freq_table, policy->cpu); cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
else
goto fail_ck;
policy->min = policy->cpuinfo.min_freq; policy->min = policy->cpuinfo.min_freq;
policy->max = policy->cpuinfo.max_freq; policy->max = policy->cpuinfo.max_freq;
@ -194,6 +198,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = 300 * 1000; policy->cpuinfo.transition_latency = 300 * 1000;
return 0; return 0;
fail_ck:
clk_put(mpu_clk);
return result;
} }
static int omap_cpu_exit(struct cpufreq_policy *policy) static int omap_cpu_exit(struct cpufreq_policy *policy)