]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (nct7363) Fix a resource leak in nct7363_present_pwm_fanin
authorFelix Gu <gu_0233@qq.com>
Thu, 15 Jan 2026 13:54:15 +0000 (21:54 +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 nct7363_present_pwm_fanin, 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_9717645269E4C07D3D131F52201E12E5E10A@qq.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/nct7363.c

index 4946d59ff807b3da5cafb43876fd01f751762f6c..20f14d5e0c948a8966debfecc48ad77444c36348 100644 (file)
@@ -349,6 +349,7 @@ static int nct7363_present_pwm_fanin(struct device *dev,
        if (ret)
                return ret;
 
+       of_node_put(args.np);
        if (args.args[0] >= NCT7363_PWM_COUNT)
                return -EINVAL;
        data->pwm_mask |= BIT(args.args[0]);