From patchwork Mon Aug 26 09:56:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 2849498 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 1235ABF546 for ; Mon, 26 Aug 2013 10:01:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB60320134 for ; Mon, 26 Aug 2013 10:01:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7ADFA20263 for ; Mon, 26 Aug 2013 10:01:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDtc0-0003Cn-JR; Mon, 26 Aug 2013 10:01:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDtbx-0002Ex-Vn; Mon, 26 Aug 2013 10:01:25 +0000 Received: from na3sys009aog117.obsmtp.com ([74.125.149.242]) by merlin.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDtbu-0002CN-Or for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2013 10:01:24 +0000 Received: from SC-OWA01.marvell.com ([199.233.58.136]) (using TLSv1) by na3sys009aob117.postini.com ([74.125.148.12]) with SMTP ID DSNKUhsnTpkkyI0GTKugqhATYK2UFuOWtc8L@postini.com; Mon, 26 Aug 2013 03:01:22 PDT Received: from maili.marvell.com (10.93.76.43) by sc-owa01.marvell.com (10.93.76.21) with Microsoft SMTP Server id 8.3.213.0; Mon, 26 Aug 2013 02:58:13 -0700 Received: from xhacker.marvell.com (unknown [10.37.135.179]) by maili.marvell.com (Postfix) with ESMTP id D0FC61CCD9C; Mon, 26 Aug 2013 02:58:09 -0700 (PDT) From: Jisheng Zhang To: , , , , , , , , Subject: [PATCH v3 3/3] pinctrl: mvebu: Convert to use devm_ioremap_resource Date: Mon, 26 Aug 2013 17:56:21 +0800 Message-ID: <1377510981-1793-4-git-send-email-jszhang@marvell.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1377510981-1793-1-git-send-email-jszhang@marvell.com> References: <1377510981-1793-1-git-send-email-jszhang@marvell.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130826_060122_954216_FF98EC6F X-CRM114-Status: GOOD ( 10.69 ) X-Spam-Score: -4.2 (----) Cc: linux@arm.linux.org.uk, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The resource mapped by of_iomap() isn't unmapped in error path. This patch fixes the resource leakage by using devm_ioremap_resource() instead of of_iomap(). Signed-off-by: Jisheng Zhang Reviewed-by: Ezequiel Garcia --- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index bb7ddb1..1caa45f 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -579,7 +579,7 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev, int mvebu_pinctrl_probe(struct platform_device *pdev) { struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev); - struct device_node *np = pdev->dev.of_node; + struct resource *res; struct mvebu_pinctrl *pctl; void __iomem *base; struct pinctrl_pin_desc *pdesc; @@ -591,11 +591,10 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) return -EINVAL; } - base = of_iomap(np, 0); - if (!base) { - dev_err(&pdev->dev, "unable to get base address\n"); - return -ENODEV; - } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl), GFP_KERNEL);