]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (emc2305) Fix a resource leak in emc2305_of_parse_pwm_child
authorFelix Gu <gu_0233@qq.com>
Thu, 15 Jan 2026 13:51:48 +0000 (21:51 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 31 Jan 2026 15:38:32 +0000 (07:38 -0800)
When calling of_parse_phandle_with_args(), the caller is responsible
to call of_node_put() to release the reference of device node.
In emc2305_of_parse_pwm_child, it does not release the reference,
causing a resource leak.

Signed-off-by: Felix Gu <gu_0233@qq.com>
Link: https://lore.kernel.org/r/tencent_738BA80BBF28F3440301EEE6F9E470165105@qq.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/emc2305.c

index 8f80a39574f31376e34479c0bbd15c3e401570cf..64b213e1451e702972a318d6d99d0c1ada01d814 100644 (file)
@@ -578,6 +578,7 @@ static int emc2305_of_parse_pwm_child(struct device *dev,
                data->pwm_output_mask |= EMC2305_OPEN_DRAIN << ch;
        }
 
+       of_node_put(args.np);
        return 0;
 }