From patchwork Sat Jun 28 17:23:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4440011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9603ABEEAA for ; Sat, 28 Jun 2014 17:27:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8BEC201E4 for ; Sat, 28 Jun 2014 17:27:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06B5F2018B for ; Sat, 28 Jun 2014 17:27:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0wMe-0005xv-9T; Sat, 28 Jun 2014 17:24:36 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0wMb-0005wr-Qq for linux-arm-kernel@lists.infradead.org; Sat, 28 Jun 2014 17:24:34 +0000 Received: by mail-pa0-f42.google.com with SMTP id lj1so6274202pab.29 for ; Sat, 28 Jun 2014 10:24:12 -0700 (PDT) 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-type :content-disposition:user-agent; bh=DhI3aJ9/pY7nMJffMhIQqnlCOcnHX92TiK7bNACjrDo=; b=dfk23t7e7DDYomS86IJB3ZHqpeBnearmvhsGQioGFH4O8XG/L8AoQOJAOb12R66iFB u2hN7Nj1DOGiXbP9CQZ3EsEokNCwFnQwu68uOpdrHQJpPYLSO4UaDUN9KSNGsb2bZoD9 ZdSYwiVgyOcv3catz1lwGbrDzB4+aTn14KjyyVYQIpnAzEfvPw6Rs3WVBj+apVhJXkIU gbYXjmED0jVG2yGFx3I5QouYAylYQ1byYaMqI3ig7D7GhNOiSzK3KfTRR+T1rQ1Cn8eP wfFVclJ6Ult36urOb0DSL5jTHzOjnx5lgg/oQtuiMhwSFVXRCPb8xavpENHE306F4loB 3eKA== X-Received: by 10.68.211.233 with SMTP id nf9mr39568567pbc.29.1403976252201; Sat, 28 Jun 2014 10:24:12 -0700 (PDT) Received: from localhost ([42.104.14.200]) by mx.google.com with ESMTPSA id tu10sm20134286pbc.43.2014.06.28.10.24.07 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 28 Jun 2014 10:24:11 -0700 (PDT) Date: Sat, 28 Jun 2014 22:53:55 +0530 From: Himangi Saraogi To: Emilio =?iso-8859-1?Q?L=F3pez?= , Mike Turquette , Maxime Ripard , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] clk: sunxi: fix devm_ioremap_resource error detection code Message-ID: <20140628172355.GA3387@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140628_102433_887064_FE694987 X-CRM114-Status: GOOD ( 12.43 ) X-Spam-Score: -0.6 (/) Cc: julia.lawall@lip6.fr X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure. A simplified version of the semantic match that finds this problem is as follows: // @@ expression e,e1; statement S; @@ *e = devm_ioremap_resource(...); if (!e1) S // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall --- drivers/clk/sunxi/clk-sun6i-apb0-gates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c index 44cd27c..670f90d 100644 --- a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c +++ b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c @@ -29,7 +29,7 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev) r = platform_get_resource(pdev, IORESOURCE_MEM, 0); reg = devm_ioremap_resource(&pdev->dev, r); - if (!reg) + if (IS_ERR(reg)) return PTR_ERR(reg); clk_parent = of_clk_get_parent_name(np, 0);