DORMANTno replies REVIEWED: 2 (2M)

1 review trailer.

[PATCH v2 1/1] bus: arm-cci: add missing of_node_put after calling of_parse_phandle

From: Peter Chen <hidden>
Date: 2016-07-04 09:27:01
Subsystem: the rest · Maintainer: Linus Torvalds

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Cc: arm at kernel.org
Cc: Will Deacon <redacted>
Signed-off-by: Peter Chen <redacted>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---

Changes for v2:
- Address suzuki's comments that calling of_node_put one time
  for both error and corrent code path.


 drivers/bus/arm-cci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index a49b283..648d130 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -1913,9 +1913,10 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
 	for (i = 0; i < nb_cci_ports; i++) {
 		ace_match = ports[i].type == type;
 		if (ace_match && cci_portn == ports[i].dn)
-			return i;
+			break;
 	}
-	return -ENODEV;
+	of_node_put(cci_portn);
+	return (i < nb_cci_ports) ? i : -ENODEV;
 }
 
 int cci_ace_get_port(struct device_node *dn)
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help