mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] hwmon: Fix resource leaks for device_node
@ 2026-01-15 13:22 Felix Gu
  2026-01-15 13:51 ` [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child Felix Gu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Felix Gu @ 2026-01-15 13:22 UTC (permalink / raw)
  To: gu_0233, Guenter Roeck, Ban Feng; +Cc: linux-hwmon, linux-kernel

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.

Signed-off-by: Felix Gu <gu_0233@qq.com>
---
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,
-- 
Felix Gu <gu_0233@qq.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child
  2026-01-15 13:22 [PATCH 0/2] hwmon: Fix resource leaks for device_node Felix Gu
@ 2026-01-15 13:51 ` Felix Gu
  2026-01-15 16:45   ` Guenter Roeck
  2026-01-15 13:54 ` [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin Felix Gu
  2026-01-15 17:23 ` [0/2] hwmon: Fix resource leaks for device_node Markus Elfring
  2 siblings, 1 reply; 6+ messages in thread
From: Felix Gu @ 2026-01-15 13:51 UTC (permalink / raw)
  To: Guenter Roeck, Ban Feng; +Cc: linux-hwmon, linux-kernel, Felix Gu

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>
---
 drivers/hwmon/emc2305.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
index 8f80a39574f3..64b213e1451e 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.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin
  2026-01-15 13:22 [PATCH 0/2] hwmon: Fix resource leaks for device_node Felix Gu
  2026-01-15 13:51 ` [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child Felix Gu
@ 2026-01-15 13:54 ` Felix Gu
  2026-01-15 16:47   ` Guenter Roeck
  2026-01-15 17:23 ` [0/2] hwmon: Fix resource leaks for device_node Markus Elfring
  2 siblings, 1 reply; 6+ messages in thread
From: Felix Gu @ 2026-01-15 13:54 UTC (permalink / raw)
  To: Guenter Roeck, Ban Feng; +Cc: linux-hwmon, linux-kernel, Felix Gu

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child
  2026-01-15 13:51 ` [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child Felix Gu
@ 2026-01-15 16:45   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-01-15 16:45 UTC (permalink / raw)
  To: Felix Gu; +Cc: Ban Feng, linux-hwmon, linux-kernel

On Thu, Jan 15, 2026 at 09:51:48PM +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 emc2305_of_parse_pwm_child, it does not release the reference,
> causing a resource leak.
> 
> Signed-off-by: Felix Gu <gu_0233@qq.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin
  2026-01-15 13:54 ` [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin Felix Gu
@ 2026-01-15 16:47   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-01-15 16:47 UTC (permalink / raw)
  To: Felix Gu; +Cc: Ban Feng, linux-hwmon, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [0/2] hwmon: Fix resource leaks for device_node
  2026-01-15 13:22 [PATCH 0/2] hwmon: Fix resource leaks for device_node Felix Gu
  2026-01-15 13:51 ` [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child Felix Gu
  2026-01-15 13:54 ` [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin Felix Gu
@ 2026-01-15 17:23 ` Markus Elfring
  2 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2026-01-15 17:23 UTC (permalink / raw)
  To: Günter Röck, linux-hwmon; +Cc: LKML, Felix Gu, Ban Feng

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-15 17:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-15 13:22 [PATCH 0/2] hwmon: Fix resource leaks for device_node Felix Gu
2026-01-15 13:51 ` [PATCH 1/2] hwmon: emc2305: Fix a resource leak in emc2305_of_parse_pwm_child Felix Gu
2026-01-15 16:45   ` Guenter Roeck
2026-01-15 13:54 ` [PATCH 2/2] hwmon: nct7363: Fix a resource leak in nct7363_present_pwm_fanin Felix Gu
2026-01-15 16:47   ` Guenter Roeck
2026-01-15 17:23 ` [0/2] hwmon: Fix resource leaks for device_node Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®