[PATCH] bus: arm-cci: fix of_node_put() leak in __cci_ace_get_port()

From: Ashutosh Desai

Date: Thu Apr 16 2026 - 22:48:00 EST


of_parse_phandle() hands back a node with its refcount bumped.
__cci_ace_get_port() uses it only for a pointer comparison against
ports[], then both return paths walk away without ever calling
of_node_put(), leaking the reference each time.

Add the missing of_node_put() on both return paths.

Fixes: ed69bdd8fd9b ("drivers: bus: add ARM CCI support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Ashutosh Desai <ashutoshdesai993@xxxxxxxxx>
---
drivers/bus/arm-cci.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 7f2baf057128..223b1fe19ba0 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -167,9 +167,12 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
cci_portn = of_parse_phandle(dn, "cci-control-port", 0);
for (i = 0; i < nb_cci_ports; i++) {
ace_match = ports[i].type == type;
- if (ace_match && cci_portn == ports[i].dn)
+ if (ace_match && cci_portn == ports[i].dn) {
+ of_node_put(cci_portn);
return i;
+ }
}
+ of_node_put(cci_portn);
return -ENODEV;
}

--
2.34.1