Skip to contentSkip to conversation

bus: arm-cci: add missing of_node_put after calling of_parse_phandle

PATCH New Peter Chen 1 participant 1 message Jul 4, 2016

lore
Share & tools
lore

Peter Chen

author
#0 lore raw

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

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 <[email protected]>

---

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(-)
drivers/bus/arm-cci.c +3 -2
index a49b283..648d130 100644
@@ -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)
Signature · 1 line
1.9.1