mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pmbus) Fix child node reference leak on early return
@ 2025-10-12 18:12 Erick Karanja
  2025-10-12 18:21 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Erick Karanja @ 2025-10-12 18:12 UTC (permalink / raw)
  To: linux
  Cc: grantpeltier93, chiang.brian, gregkh, peterz, linux-hwmon,
	linux-kernel, Erick Karanja

In the case of an  early return, the reference to the
child node needs to be release.

Use for_each_child_of_node_scoped to fix the issue.

Fixes: 3996187f80a0e ("hwmon: (pmbus/isl68137) add support for voltage divider on Vout")
Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
---
 drivers/hwmon/pmbus/isl68137.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/isl68137.c b/drivers/hwmon/pmbus/isl68137.c
index 52cf62e45a86..6bba9b50c51b 100644
--- a/drivers/hwmon/pmbus/isl68137.c
+++ b/drivers/hwmon/pmbus/isl68137.c
@@ -336,10 +336,9 @@ static int isl68137_probe_from_dt(struct device *dev,
 				  struct isl68137_data *data)
 {
 	const struct device_node *np = dev->of_node;
-	struct device_node *child;
 	int err;
 
-	for_each_child_of_node(np, child) {
+	for_each_child_of_node_scoped(np, child) {
 		if (strcmp(child->name, "channel"))
 			continue;
 
-- 
2.43.0


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

* Re: [PATCH] hwmon: (pmbus) Fix child node reference leak on early return
  2025-10-12 18:12 [PATCH] hwmon: (pmbus) Fix child node reference leak on early return Erick Karanja
@ 2025-10-12 18:21 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2025-10-12 18:21 UTC (permalink / raw)
  To: Erick Karanja
  Cc: grantpeltier93, chiang.brian, gregkh, peterz, linux-hwmon, linux-kernel

On Sun, Oct 12, 2025 at 09:12:49PM +0300, Erick Karanja wrote:
> In the case of an  early return, the reference to the
> child node needs to be release.
> 
> Use for_each_child_of_node_scoped to fix the issue.
> 
> Fixes: 3996187f80a0e ("hwmon: (pmbus/isl68137) add support for voltage divider on Vout")
> Signed-off-by: Erick Karanja <karanja99erick@gmail.com>

Applied.

Thanks,
Guenter

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

end of thread, other threads:[~2025-10-12 18:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-12 18:12 [PATCH] hwmon: (pmbus) Fix child node reference leak on early return Erick Karanja
2025-10-12 18:21 ` Guenter Roeck

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®