Thread (5 messages) 5 messages, 3 authors, 2014-08-27
STALE4318d

[PATCH 11/14] ARM: brcmstb: delete unneeded test before of_node_put

From: Julia Lawall <hidden>
Date: 2014-08-08 10:13:18
Also in: kernel-janitors, lkml
Subsystem: arm port, broadcom bcm281xx/bcm11xxx/bcm216xx arm architecture, broadcom bcm7xxx arm architecture, the rest · Maintainers: Russell King, Florian Fainelli, Ray Jui, Scott Branden, Linus Torvalds

From: Julia Lawall <redacted>

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/)

// <smpl>
@@
expression e;
@@

-if (e)
   of_node_put(e);
// </smpl>

Signed-off-by: Julia Lawall <redacted>

---
 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;
 }
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help