Release the mpu_clk in fail paths. Reported-by: Todd Poynor <toddpoynor@xxxxxxxxxx> Signed-off-by: Nishanth Menon <nm@xxxxxx> --- arch/arm/mach-omap2/omap2plus-cpufreq.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c index f026ac4..594100e 100644 --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c @@ -226,8 +226,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) if (IS_ERR(mpu_clk)) return PTR_ERR(mpu_clk); - if (policy->cpu >= NR_CPUS) - return -EINVAL; + if (policy->cpu >= NR_CPUS) { + result = -EINVAL; + goto fail1; + } policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); @@ -235,7 +237,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) if (result || !freq_table) { dev_err(mpu_dev, "%s: cpu%d: unable to get freq table [%d]\n", __func__, policy->cpu, result); - return result; + goto fail1; } mutex_lock(&freq_table_lock); @@ -244,8 +246,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) mutex_unlock(&freq_table_lock); dev_err(mpu_dev, "%s: cpu%d: unable to get cpuinfo [%d]\n", __func__, policy->cpu, result); - freq_table_free(); - return result; + goto fail2; } cpufreq_frequency_table_get_attr(freq_table, policy->cpu); mutex_unlock(&freq_table_lock); @@ -271,6 +272,12 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = 300 * 1000; return 0; + +fail2: + freq_table_free(); +fail1: + clk_put(mpu_clk); + return result; } static int omap_cpu_exit(struct cpufreq_policy *policy) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html