hwmon: Fix resource leaks for device_node
Subsystems (2)
cover hwmon: Fix resource leaks for device_node
When calling of_parse_phandle_with_args(), the caller is responsible to call of_node_put() to release the reference of device node. In current code, it does not release the reference, causing a resource leak.
---
Felix Gu (2):
hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child
hwmon: nct7353: Fix a resource leak in nct7363_present_pwm_fanin
drivers/hwmon/emc2305.c | 1 + drivers/hwmon/nct7363.c | 1 + 2 files changed, 2 insertions(+)
---
base-commit: 9b7977f9e39b7768c70c2aa497f04e7569fd3e00
change-id: 20260115-hwmon-fixes-3d29ded39dbf
Best regards,
Signature · 1 line
Felix Gu <[email protected]>
PATCH 1/2 hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child
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.
--- drivers/hwmon/emc2305.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/emc2305.c +1 -0
@@ -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 ; }
Signature · 1 line
2.43.0
Re: [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child
Quoted 6 lines · Felix Gu
When calling
of_parse_phandle_with_args(), the caller is responsible to callof_node_put()to release the reference of device node. Inemc2305_of_parse_pwm_child, it does not release the reference, causing a resource leak.Signed-off-by Felix Gu <[email protected]>
Applied.
Thanks,
Guenter
PATCH 2/2 hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin
In reply to Felix GuWhen 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.
--- drivers/hwmon/nct7363.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/nct7363.c +1 -0
@@ -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 ]);
Signature · 1 line
2.43.0
Re: [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin
Quoted 6 lines · Felix Gu
When calling
of_parse_phandle_with_args(), the caller is responsible to callof_node_put()to release the reference of device node. Innct7363_present_pwm_fanin, it does not release the reference, causing a resource leak.Signed-off-by Felix Gu <[email protected]>
Applied.
Thanks,
Guenter
See also:
* hwmon: (emc2305) Fix a resource leak in emc2305_of_parse_pwm_child
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?h=hwmon-next&id=6b3a30846c23af1b36f1c1726e6ab5d6c9aa90cc
* hwmon: (nct7363) Fix a resource leak in nct7363_present_pwm_fanin
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?h=hwmon-next&id=e59f0a584366b775e1dee39e183d8b37e6c0443d
I wonder why these commits did not get the tag “Fixes” together with the “stable” annotation.
Regards,
Markus