From patchwork Mon Apr 25 23:08:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 8933471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 37CCE9F441 for ; Mon, 25 Apr 2016 23:12:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A1A72013A for ; Mon, 25 Apr 2016 23:12:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8FDA42012B for ; Mon, 25 Apr 2016 23:12:41 +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 1aupey-0006G8-Fp; Mon, 25 Apr 2016 23:11:20 +0000 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aupep-0005dA-Dc for linux-arm-kernel@lists.infradead.org; Mon, 25 Apr 2016 23:11:12 +0000 Received: by mail-pf0-x22c.google.com with SMTP id c189so27678508pfb.3 for ; Mon, 25 Apr 2016 16:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=JkAMXbpnCC987bKLtHiika8U1N46yOYP6C/K05u8KR0=; b=YxxTtWXbv0a5MoW4EdXvsjkJkoXQzVBUo9xR0LDbytEtyB3C5MS9UAJelTizAeQhbs wqqSyyndpOZxBJxEu/fx7/oVM1bAddN6QlCBtlfvgCd43pzZb7PbL7h5bntAgHBmR56o Fr5BqA/DlTtze9dQXT4vM19Lru3M77WOTa1Y3qjNV7JUMIzMTNvgbMy9krXta/2MWU9g yAB7myDYtWcN/BQSD83BFF9UlbAHRF7XDML4TRa7NEnQPpQd+0ORVrhXOdLlUiLTyeyP A4Z7cR6a71j30og5Z1XzW8FByDjcMtzUjkgzG4ydZdlAbDTe3vHjIiKfJflJtrlNzQy/ 94jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=JkAMXbpnCC987bKLtHiika8U1N46yOYP6C/K05u8KR0=; b=bFw7Ul1673gNOPLQzlc5UPmzN4ThvOjDA4Rnd3NI0itp6CyukyLNmgL0MBWMUYnJqT SecL55bwrsCnVJZJWficYQTB/i3GTuXNHHdvlINv67FrVlba4XURYZVkzz5htZ2pQxp1 rSbeb3YwUaLjP6qIgv6htsXtk6imiZE3NhNuVmFCp+8D8vpUEJrxm7fY/TWO7jMa8qvK rE8zkVee1mIizm3pcIN/UCF/9i+ucYoMR7OiYzuDnfmktZRKuzZ9oKO+5et2TeaVhqtR mDDjonDerBJWObeVgPWFvvG99qo6nqMR+zEIK/gi9tHiu+L1ux+O6cn09dRwMa2HsWpu Z3XA== X-Gm-Message-State: AOPr4FVdZ4qROrgbHE2Y+6Pv+ESLrJZoDFHS8k5Rwiq7FRr/qDmxAo+j+ipnBWgdoRY9ww== X-Received: by 10.98.69.1 with SMTP id s1mr666338pfa.56.1461625850608; Mon, 25 Apr 2016 16:10:50 -0700 (PDT) Received: from fainelli-desktop.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by smtp.gmail.com with ESMTPSA id d78sm25638816pfb.59.2016.04.25.16.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Apr 2016 16:10:49 -0700 (PDT) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] soc: brcmstb: Unmap sun_top_ctrl_base on errors Date: Mon, 25 Apr 2016 16:08:09 -0700 Message-Id: <1461625693-22793-1-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 2.1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160425_161111_549024_619537FE X-CRM114-Status: GOOD ( 12.32 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , arnd@arndb.de, open list , Justin Chen , "open list:BROADCOM BCM7XXX ARM ARCHITECTURE" , Gregory Fong , Brian Norris MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Do not leak a ioremap()'d cookie around, unmaping it in case of errors Fixes: cef4bafcea2c ("soc: brcmstb: add SoC driver to brcmstb") Signed-off-by: Florian Fainelli --- Arnd, Feel free to squash this one and your patch into the original commit, thanks! drivers/soc/brcmstb/common.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/soc/brcmstb/common.c b/drivers/soc/brcmstb/common.c index daf86acf9d01..94e7335553f4 100644 --- a/drivers/soc/brcmstb/common.c +++ b/drivers/soc/brcmstb/common.c @@ -51,6 +51,7 @@ static int __init brcmstb_soc_device_init(void) struct soc_device *soc_dev; struct device_node *sun_top_ctrl; void __iomem *sun_top_ctrl_base; + int ret = 0; sun_top_ctrl = of_find_matching_node(NULL, sun_top_ctrl_match); if (!sun_top_ctrl) @@ -64,8 +65,10 @@ static int __init brcmstb_soc_device_init(void) product_id = readl(sun_top_ctrl_base + 0x4); soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); - if (!soc_dev_attr) - return -ENOMEM; + if (!soc_dev_attr) { + ret = -ENOMEM; + goto out; + } soc_dev_attr->family = kasprintf(GFP_KERNEL, "%x", family_id >> 28 ? @@ -83,9 +86,14 @@ static int __init brcmstb_soc_device_init(void) kfree(soc_dev_attr->soc_id); kfree(soc_dev_attr->revision); kfree(soc_dev_attr); - return -ENODEV; + ret = -ENODEV; + goto out; } return 0; + +out: + iounmap(sun_top_ctrl_base); + return ret; } arch_initcall(brcmstb_soc_device_init);