]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
hwmon: (pmbus/isl68137) Fix child node reference leak on early return
authorErick Karanja <karanja99erick@gmail.com>
Sun, 12 Oct 2025 18:12:49 +0000 (21:12 +0300)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 20 Oct 2025 01:56:14 +0000 (18:56 -0700)
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>
drivers/hwmon/pmbus/isl68137.c

index 52cf62e45a86f14fd179482ff851e70eebb74c12..6bba9b50c51bfce1e3f1b4be47389b0c1cc82f3c 100644 (file)
@@ -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;