From patchwork Fri Aug 8 10:07:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 4695041 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 74C10C0338 for ; Fri, 8 Aug 2014 10:14:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2F33200DF for ; Fri, 8 Aug 2014 10:14:19 +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 D4627201B4 for ; Fri, 8 Aug 2014 10:14:18 +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 1XFh9j-0004jR-LK; Fri, 08 Aug 2014 10:12:15 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XFh9c-0004aS-RJ for linux-arm-kernel@lists.infradead.org; Fri, 08 Aug 2014 10:12:09 +0000 X-IronPort-AV: E=Sophos;i="5.01,824,1400018400"; d="scan'208";a="88704759" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Aug 2014 12:11:09 +0200 From: Julia Lawall To: Marc Carino Subject: [PATCH 11/14] ARM: brcmstb: delete unneeded test before of_node_put Date: Fri, 8 Aug 2014 12:07:52 +0200 Message-Id: <1407492475-26283-11-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140808_031209_178886_A0B47C0D X-CRM114-Status: UNSURE ( 8.40 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.4 (----) Cc: Russell King , Christian Daudt , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Matt Porter , bcm-kernel-feedback-list@broadcom.com, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Brian Norris , linux-arm-kernel@lists.infradead.org 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: , 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=-2.6 required=5.0 tests=BAYES_00,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 From: Julia Lawall Simplify the error path to avoid calling of_node_put when it is not needed. The semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e; @@ -if (e) of_node_put(e); // Signed-off-by: Julia Lawall --- arch/arm/mach-bcm/platsmp-brcmstb.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c index af780e9..c515ea1 100644 --- a/arch/arm/mach-bcm/platsmp-brcmstb.c +++ b/arch/arm/mach-bcm/platsmp-brcmstb.c @@ -227,7 +227,7 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np) if (!syscon_np) { pr_err("can't find phandle %s\n", name); rc = -EINVAL; - goto cleanup; + goto out; } cpubiuctrl_block = of_iomap(syscon_np, 0); @@ -256,9 +256,8 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np) } cleanup: - if (syscon_np) - of_node_put(syscon_np); - + of_node_put(syscon_np); +out: return rc; } @@ -274,7 +273,7 @@ static int __init setup_hifcont_regs(struct device_node *np) if (!syscon_np) { pr_err("can't find phandle %s\n", name); rc = -EINVAL; - goto cleanup; + goto out; } hif_cont_block = of_iomap(syscon_np, 0); @@ -288,9 +287,8 @@ static int __init setup_hifcont_regs(struct device_node *np) hif_cont_reg = 0; cleanup: - if (syscon_np) - of_node_put(syscon_np); - + of_node_put(syscon_np); +out: return rc; }