[PATCH 6.19 231/844] hwmon: (emc2305) Fix a resource leak in emc2305_of_parse_pwm_child

From: Sasha Levin

Date: Sat Feb 28 2026 - 13:15:48 EST


From: Felix Gu <gu_0233@xxxxxx>

[ Upstream commit 2954ce672b7623478c1cfeb69e6a6e4042a3656e ]

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@xxxxxx>
Link: https://lore.kernel.org/r/tencent_738BA80BBF28F3440301EEE6F9E470165105@xxxxxx
Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/hwmon/emc2305.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
index ceae96c07ac45..67e82021da210 100644
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -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;
}

--
2.51.0