Skip to contentSkip to conversation

hwmon: (pmbus) Fix child node reference leak on early return

PATCH Applied Erick Karanja 2 participants 2 messages Oct 12, 2025 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (pmbus) Fix child node reference leak on early return

In the case of an early return, the reference to the child node needs to be release.

Use for_each_child_of_node_scoped to fix the issue.

Fixes 3996187f80a0e ("hwmon: (pmbus/isl68137) add support for voltage divider on Vout")
---
 drivers/hwmon/pmbus/isl68137.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwmon/pmbus/isl68137.c +1 -2
index 52cf62e45a86..6bba9b50c51b 100644
@@ -336,10 +336,9 @@ static int isl68137_probe_from_dt(struct device *dev,
 				  struct isl68137_data *data)
 {
 	const struct device_node *np = dev->of_node;
-	struct device_node *child;
 	int err;
 
-	for_each_child_of_node(np, child) {
+	for_each_child_of_node_scoped(np, child) {
 		if (strcmp(child->name, "channel"))
 			continue;
 
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 7 lines · Erick Karanja

In the case of an early return, the reference to the child node needs to be release.

Use for_each_child_of_node_scoped to fix the issue.

Fixes 3996187f80a0e ("hwmon: (pmbus/isl68137) add support for voltage divider on Vout")

Applied.

Thanks,
Guenter