[PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin

Felix Gu posted 2 patches 3 weeks, 4 days ago
[PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin
Posted by Felix Gu 3 weeks, 4 days ago
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>
---
 drivers/hwmon/nct7363.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/nct7363.c b/drivers/hwmon/nct7363.c
index 4946d59ff807..20f14d5e0c94 100644
--- a/drivers/hwmon/nct7363.c
+++ b/drivers/hwmon/nct7363.c
@@ -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]);
-- 
2.43.0
Re: [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin
Posted by Guenter Roeck 3 weeks, 4 days ago
On Thu, Jan 15, 2026 at 09:54:15PM +0800, Felix Gu wrote:
> 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>

Applied.

Thanks,
Guenter