Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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

Use for_each_child_of_node_scoped to fix the issue.

Fixes: 3996187f80a0e ("hwmon: (pmbus/isl68137) add support for voltage divider on Vout")
Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
Link: https://lore.kernel.org/r/20251012181249.359401-1-karanja99erick@gmail.com
[groeck: Updated subject/description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Erick Karanja and committed by
Guenter Roeck
57f6f479 72ac1485

+1 -2
+1 -2
drivers/hwmon/pmbus/isl68137.c
··· 336 336 struct isl68137_data *data) 337 337 { 338 338 const struct device_node *np = dev->of_node; 339 - struct device_node *child; 340 339 int err; 341 340 342 - for_each_child_of_node(np, child) { 341 + for_each_child_of_node_scoped(np, child) { 343 342 if (strcmp(child->name, "channel")) 344 343 continue; 345 344