Commit e8e3da65b13e9911d852ccf6a0e4900522aaef7e
Committed by
Afzal Mohammed
1 parent
c79589dc5e
Exists in
master
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> [vaibhav.bedia@ti.com: Pull in for AM33xx] Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
Showing 1 changed file with 11 additions and 3 deletions Side-by-side Diff
drivers/cpufreq/omap-cpufreq.c
... | ... | @@ -159,8 +159,10 @@ |
159 | 159 | if (IS_ERR(mpu_clk)) |
160 | 160 | return PTR_ERR(mpu_clk); |
161 | 161 | |
162 | - if (policy->cpu >= NR_CPUS) | |
163 | - return -EINVAL; | |
162 | + if (policy->cpu >= NR_CPUS) { | |
163 | + result = -EINVAL; | |
164 | + goto fail_ck; | |
165 | + } | |
164 | 166 | |
165 | 167 | policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); |
166 | 168 | result = opp_init_cpufreq_table(mpu_dev, &freq_table); |
167 | 169 | |
... | ... | @@ -168,12 +170,14 @@ |
168 | 170 | if (result) { |
169 | 171 | dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", |
170 | 172 | __func__, policy->cpu, result); |
171 | - return result; | |
173 | + goto fail_ck; | |
172 | 174 | } |
173 | 175 | |
174 | 176 | result = cpufreq_frequency_table_cpuinfo(policy, freq_table); |
175 | 177 | if (!result) |
176 | 178 | cpufreq_frequency_table_get_attr(freq_table, policy->cpu); |
179 | + else | |
180 | + goto fail_ck; | |
177 | 181 | |
178 | 182 | policy->min = policy->cpuinfo.min_freq; |
179 | 183 | policy->max = policy->cpuinfo.max_freq; |
... | ... | @@ -195,6 +199,10 @@ |
195 | 199 | policy->cpuinfo.transition_latency = 300 * 1000; |
196 | 200 | |
197 | 201 | return 0; |
202 | + | |
203 | +fail_ck: | |
204 | + clk_put(mpu_clk); | |
205 | + return result; | |
198 | 206 | } |
199 | 207 | |
200 | 208 | static int omap_cpu_exit(struct cpufreq_policy *policy) |