Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419904

[PATCH] ARM: zx: Fix devm_ioremap_resource error detection code

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Amitoj Kaur Chawla <amitoj1606@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] ARM: zx: Fix devm_ioremap_resource error detection code
Date Sat, 11 Jun 2016 06:10:01 +0200
Message-ID <rIIpb-6Cf-3@gated-at.bofh.it> (permalink)
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=6saRl234V7aC1qzI72XwvuA10f5YQvjTUhaUE5KESi4=; b=PEVbFlCMSR/TIJKkhIpdSWuUHiangkY3yFcvaAAH7drHwHyh8xQuK1GzdL9em3aWic gfe+Om9Mla0Y1vZiVfbhD8KNvhUiqV/hW/JcPtIBNVw+wG5q2CtBIW7TK6R7i9Q+VBhK iyr2lGFWqaAoujvE/32l4hlCbIta//T16Dm8Sj6/cNn8h+s0s7KJ8SvprBmt+LCkAUel TLw7RVntdy+5zGwhWVsPBw1hA2vifOPgvy/65Km+72eeYRhF3MPnLFWsDoQ9Ckc4soKx a/4QODk8yxA4LOEH7s0w7AFKPxah9/acN7vJ1c+GSRkFHecg4JDY1yQ8G9K8ZKU40U7Q uhFw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=6saRl234V7aC1qzI72XwvuA10f5YQvjTUhaUE5KESi4=; b=fwOyx4PZ4FBl8YWw8e9coReGIISXkwtRj5bPK9fRb2NLKwSLZtn4KDHN+rzPHeoZNc VENF8uQ/QYqoWIfZhFsUWIHU0hCiJp2OtcZjoVfJfpGxS4VqPkgEneWUMjCqGtiwBmwJ 9u4ivcwvJzqPHi44vbznVPenK0EoF4RPKw8IykzOMVmYgBjH/keImNKEjoG34xlKPF8L 7GShZzRDcBeEop0LOzdx60WuLAzujW+1L7L1RhDD7WT6Wk1G5CiGSlNOCA3YediWeBnV jon5R65qZgf7GJ7qmowBTY0S6aFCllUxWlFNL8o+EJCTelBsKLxfloSXglpFTji25w4O sLXQ==
X-Gm-Message-State ALyK8tJzLsuzhyl78W2zd9SisuospKu1qdN2tUH9Ceq+Hsqo7md0LD7vmUZWMxFC6KETeA==
X-Received by 10.98.13.81 with SMTP id v78mr6103255pfi.91.1465617924294; Fri, 10 Jun 2016 21:05:24 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 43
Organization linux.* mail to news gateway
X-Original-Cc julia.lawall@lip6.fr
X-Original-Date Sat, 11 Jun 2016 09:35:20 +0530
X-Original-Message-ID <20160611040520.GA20393@amitoj-Inspiron-3542>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1419904

Show key headers only | View raw


Remove unnecessary error handling after the call to
platform_get_resource and fix error handling for devm_ioremap_resource

The Coccinelle semantic patch that was used to help find this is as
follows:
@@
expression e,e1;
statement S;
@@

*e = devm_ioremap_resource(...);
if (!e1) S

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 arch/arm/mach-zx/zx296702-pm-domain.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-zx/zx296702-pm-domain.c b/arch/arm/mach-zx/zx296702-pm-domain.c
index e08574d..17f778b 100644
--- a/arch/arm/mach-zx/zx296702-pm-domain.c
+++ b/arch/arm/mach-zx/zx296702-pm-domain.c
@@ -163,16 +163,9 @@ static int zx296702_pd_probe(struct platform_device *pdev)
 	genpd_data->num_domains = ARRAY_SIZE(zx296702_pm_domains);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "no memory resource defined\n");
-		return -ENODEV;
-	}
-
 	pcubase = devm_ioremap_resource(&pdev->dev, res);
-	if (!pcubase) {
-		dev_err(&pdev->dev, "ioremap fail.\n");
-		return -EIO;
-	}
+	if (IS_ERR(pcubase))
+		return PTR_ERR(pcubase);
 
 	for (i = 0; i < ARRAY_SIZE(zx296702_pm_domains); ++i)
 		pm_genpd_init(zx296702_pm_domains[i], NULL, false);
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] ARM: zx: Fix devm_ioremap_resource error detection code Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-06-11 06:10 +0200

csiph-web