Skip to contentSkip to conversation

drivers: bus: fix device node reference leak in __cci_ace_get_port

PATCH In review Miaoqian Lin 3 participants 3 messages Sep 2, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: bus: fix device node reference leak in __cci_ace_get_port

Add missing of_node_put() call to release
the device node reference obtained via of_parse_phandle().

Fixes ed69bdd8fd9b ("drivers: bus: add ARM CCI support")
---
 drivers/bus/arm-cci.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/bus/arm-cci.c +7 -3
index b8184a903583..af180f884f1d 100644
@@ -163,14 +163,18 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
 	int i;
 	bool ace_match;
 	struct device_node *cci_portn;
+	int ret = -ENODEV;
 
 	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)
-			return i;
+		if (ace_match && cci_portn == ports[i].dn) {
+			ret = i;
+			break;
+		}
 	}
-	return -ENODEV;
+	of_node_put(cci_portn);
+	return ret;
 }
 
 int cci_ace_get_port(struct device_node *dn)
Signature · 1 line
2.35.1
#1 lore raw
Quoted 2 lines

Add missing of_node_put() call to release
the device node reference obtained via of_parse_phandle().

1. You may occasionally put more than 58 characters into text lines of such a change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc4#n638

2. Would you like to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/of.h#L138

3. How do you think about to append parentheses to the function name in the summary phrase?

Regards,
Markus

#2 lore raw
Quoted 7 lines · Markus Elfring
Quoted 2 lines

Add missing of_node_put() call to release
the device node reference obtained via of_parse_phandle().

1. You may occasionally put more than 58 characters into text lines of such a change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc4#n638

Quoted 6 lines

2. Would you like to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/of.h#L138

3. How do you think about to append parentheses to the function name in the summary phrase?

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them.

thanks,

greg k-h's patch email bot