From patchwork Fri Jan 4 16:59:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13805 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BF82823EC8 for ; Fri, 4 Jan 2013 17:00:07 +0000 (UTC) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by fiordland.canonical.com (Postfix) with ESMTP id 65E37A197DE for ; Fri, 4 Jan 2013 17:00:07 +0000 (UTC) Received: by mail-vb0-f45.google.com with SMTP id p1so16577380vbi.4 for ; Fri, 04 Jan 2013 09:00:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=PxoZ7JVlnq7Q9WgN7BYauedQa9Cv/yymcaVGUiIm78E=; b=SOcnfJiSpJMED+HdXRwNJK4q3pFgmmAOgofCJ7fZflJXFt2fat3enLjSB7dcoM9Tsf z5oRGUDjgNEtfwk6YbWfuKZgPDiPzOSMzZtEaq0eeNDp8Z1nbsI8r4NXZ/Xm04zfRWXY jSFcInnyGmuNlGnx2HwonIgxSfG/0+yqGhV0ZiiCWk44Cw33VLz7rYFwpY7wLcVIBIq3 J2YoJGYVX0hPeJsPPmccWjO/N+9d87+C9T3IyDWoZ+qLR7jb0wJ7s3VYPvA6zS6ORMrj pZFekg8PBvTfp0GLWhVJFSaKEoRElfcotEGsQ38DmkcvCS0bVa3kl2ofSgn4BuGtApwi enFQ== X-Received: by 10.220.8.18 with SMTP id f18mr74935600vcf.14.1357318806900; Fri, 04 Jan 2013 09:00:06 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp146421veb; Fri, 4 Jan 2013 09:00:06 -0800 (PST) X-Received: by 10.194.71.140 with SMTP id v12mr84725241wju.36.1357318805099; Fri, 04 Jan 2013 09:00:05 -0800 (PST) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id cx5si77068542wib.11.2013.01.04.09.00.04 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 09:00:05 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: by mail-wg0-f50.google.com with SMTP id es5so7835822wgb.5 for ; Fri, 04 Jan 2013 09:00:04 -0800 (PST) X-Received: by 10.194.76.137 with SMTP id k9mr85187022wjw.29.1357318804673; Fri, 04 Jan 2013 09:00:04 -0800 (PST) Received: from mai.home (AToulouse-654-1-322-234.w86-199.abo.wanadoo.fr. [86.199.209.234]) by mx.google.com with ESMTPS id t17sm91133761wiv.6.2013.01.04.09.00.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 09:00:03 -0800 (PST) From: Daniel Lezcano To: kgene.kim@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, patches@linaro.org, linaro-dev@lists.linaro.org Subject: [PATCH 2/5] ARM: exynos: handle properly the return values Date: Fri, 4 Jan 2013 17:59:56 +0100 Message-Id: <1357318799-24378-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357318799-24378-1-git-send-email-daniel.lezcano@linaro.org> References: <1357318799-24378-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQl9EPzwJ60oqVAPZAy8N869lNwz2XF5R+4oAlEVxdeFkwcJM0HGPk+ht8dvw1Dv2U+ZN4X1 The cpuidle_register_driver return value is not checked. The init function returns always -EIO when cpuidle_register_device fails but the error could be different. This patch fixes that by checking the cpuidle_register_driver properly and returning the correct value when cpuidle_register_device fails. Signed-off-by: Daniel Lezcano --- arch/arm/mach-exynos/cpuidle.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index f8dd1cd..a5fe194 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -193,13 +193,17 @@ static void __init exynos5_core_down_clk(void) static int __init exynos4_init_cpuidle(void) { - int cpu_id; + int cpu_id, ret; struct cpuidle_device *device; if (soc_is_exynos5250()) exynos5_core_down_clk(); - cpuidle_register_driver(&exynos4_idle_driver); + ret = cpuidle_register_driver(&exynos4_idle_driver); + if (ret) { + printk(KERN_ERR "CPUidle failed to register driver\n"); + return ret; + } for_each_cpu(cpu_id, cpu_online_mask) { device = &per_cpu(exynos4_cpuidle_device, cpu_id); @@ -209,9 +213,10 @@ static int __init exynos4_init_cpuidle(void) if (cpu_id != 0) device->state_count = 1; - if (cpuidle_register_device(device)) { - printk(KERN_ERR "CPUidle register device failed\n,"); - return -EIO; + ret = cpuidle_register_device(device); + if (ret) { + printk(KERN_ERR "CPUidle register device failed\n"); + return ret; } }