From patchwork Fri May 27 02:39:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 822532 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4R2dU79014915 for ; Fri, 27 May 2011 02:39:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758658Ab1E0Cjj (ORCPT ); Thu, 26 May 2011 22:39:39 -0400 Received: from na3sys009aog107.obsmtp.com ([74.125.149.197]:54347 "EHLO na3sys009aog107.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753349Ab1E0Cjj (ORCPT ); Thu, 26 May 2011 22:39:39 -0400 Received: from mail-yw0-f47.google.com ([209.85.213.47]) (using TLSv1) by na3sys009aob107.postini.com ([74.125.148.12]) with SMTP ID DSNKTd8O6hIoFGzaAOIGOy3pctVWUOf4zEky@postini.com; Thu, 26 May 2011 19:39:39 PDT Received: by mail-yw0-f47.google.com with SMTP id 8so636143ywg.20 for ; Thu, 26 May 2011 19:39:38 -0700 (PDT) Received: by 10.150.217.5 with SMTP id p5mr1554339ybg.225.1306463978375; Thu, 26 May 2011 19:39:38 -0700 (PDT) Received: from localhost (dragon.ti.com [192.94.94.33]) by mx.google.com with ESMTPS id o3sm112157yhm.37.2011.05.26.19.39.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2011 19:39:37 -0700 (PDT) From: Nishanth Menon To: linux-omap Cc: Kevin , Nishanth Menon Subject: [PM-WIP_CPUFREQ][PATCH v4 3/4] OMAP2+: cpufreq: put clk if cpu_init failed Date: Thu, 26 May 2011 19:39:19 -0700 Message-Id: <1306463960-27340-4-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1306463960-27340-1-git-send-email-nm@ti.com> References: <1306463960-27340-1-git-send-email-nm@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 27 May 2011 02:39:40 +0000 (UTC) Release the mpu_clk in fail paths. Reported-by: Todd Poynor Signed-off-by: Nishanth Menon --- arch/arm/mach-omap2/omap2plus-cpufreq.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c index e10fcf8..40b2a7c 100644 --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c @@ -162,8 +162,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 fail_ck; + } policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); result = opp_init_cpufreq_table(mpu_dev, &freq_table); @@ -171,12 +173,14 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) if (result) { dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", __func__, policy->cpu, result); - return result; + goto fail_ck; } result = cpufreq_frequency_table_cpuinfo(policy, freq_table); if (!result) cpufreq_frequency_table_get_attr(freq_table, policy->cpu); + else + goto fail_ck; policy->min = policy->cpuinfo.min_freq; policy->max = policy->cpuinfo.max_freq; @@ -199,6 +203,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = 300 * 1000; return 0; + +fail_ck: + clk_put(mpu_clk); + return result; } static int omap_cpu_exit(struct cpufreq_policy *policy)