From patchwork Fri Mar 29 10:31:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2365021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 10A24DFB79 for ; Fri, 29 Mar 2013 10:35:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULWbd-00048B-78; Fri, 29 Mar 2013 10:32:21 +0000 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULWb5-00040d-Hn for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2013 10:31:49 +0000 Received: by mail-we0-f169.google.com with SMTP id x43so265264wey.14 for ; Fri, 29 Mar 2013 03:31:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=iSdTKqGWkKs+8C++oUkknDzm7eCR3KTcxN9JalVYkrk=; b=kX7/+qD3ufa3A8dYPleBnhUVCJEEYBnEA3IFDFxFZ1w5M00w4K6njWupEXlmD64vRi /UBM/4yrv3oLHnNVlp+dnuhyckMLTgw6hllOwVf1rBxZDiobpW8fPI7vDUjrnyNx4Ljx 7DEpOR2A96HVn8hCrp2BbWytp4bOOwDYb9aaK/hY/SrrYcDtjQbuqj0DwbRzyAxUYTKl /FnpMZBenpmM0Fc8+gsP98KtomzxaE55vnIQo/cCKmRcB4KDTKR+EtQjtA9+Uawba4tM mHkMN4j9h0fMaMpN94ScP+cXUPrvKeVc15QjacxEpqRSEm5Yoy+XfuZPnX7jsC99tIAV n8QA== X-Received: by 10.180.92.97 with SMTP id cl1mr21479041wib.19.1364553105263; Fri, 29 Mar 2013 03:31:45 -0700 (PDT) Received: from mai.home (AToulouse-654-1-486-7.w92-146.abo.wanadoo.fr. [92.146.77.7]) by mx.google.com with ESMTPS id q13sm2472076wie.0.2013.03.29.03.31.43 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Mar 2013 03:31:44 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Subject: [PATCH 4/9] ARM: OMAP4: cpuidle: fix wrong driver initialization Date: Fri, 29 Mar 2013 11:31:30 +0100 Message-Id: <1364553095-25110-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364553095-25110-1-git-send-email-daniel.lezcano@linaro.org> References: <1364553095-25110-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQnQjc0y52PWXkCpclIjE1hJtkoU0b1FoWzW3ocC5TL2VW6bRer5ghw9rTLVJoV8UZ+CHnbB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130329_063147_872570_7185295C X-CRM114-Status: GOOD ( 12.71 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-kernel@lists.linaro.org, linux@arm.linux.org.uk, arnd@arndb.de, swarren@wwwdotorg.org, patches@linaro.org, linux-pm@vger.kernel.org, rnayak@ti.com, nsekhar@ti.com, santosh.shilimkar@ti.com, linux-tegra@vger.kernel.org, horms+renesas@verge.net.au, linux-arm-kernel@lists.infradead.org, lenb@kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The driver is initialized several times. This is wrong and if the return code of the function was checked, it will return -EINVAL. Move this initialization out of the loop. Signed-off-by: Daniel Lezcano --- arch/arm/mach-omap2/cpuidle44xx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index f4b1b23..3d33b8a 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c @@ -210,6 +210,7 @@ int __init omap4_idle_init(void) { struct cpuidle_device *dev; unsigned int cpu_id = 0; + int ret; mpu_pd = pwrdm_lookup("mpu_pwrdm"); cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm"); @@ -222,14 +223,18 @@ int __init omap4_idle_init(void) if (!cpu_clkdm[0] || !cpu_clkdm[1]) return -ENODEV; + ret = cpuidle_register_driver(&omap4_idle_driver); + if (ret) { + printk(KERN_ERR "failed to register the idle driver\n"); + return ret; + } + for_each_cpu(cpu_id, cpu_online_mask) { dev = &per_cpu(omap4_idle_dev, cpu_id); dev->cpu = cpu_id; #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED dev->coupled_cpus = *cpu_online_mask; #endif - cpuidle_register_driver(&omap4_idle_driver); - if (cpuidle_register_device(dev)) { pr_err("%s: CPUidle register failed\n", __func__); return -EIO;