[PATCH] hwmon: (emc2305): fix double put in emc2305_probe_childs_from_dt

xiaopeitux@foxmail.com posted 1 patch 2 weeks ago
drivers/hwmon/emc2305.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] hwmon: (emc2305): fix double put in emc2305_probe_childs_from_dt
Posted by xiaopeitux@foxmail.com 2 weeks ago
From: Pei Xiao <xiaopei01@kylinos.cn>

./drivers/hwmon/emc2305.c:597:4-15: ERROR: probable double put

Device node iterators put the previous value of the index variable, so an
explicit put causes a double put.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 drivers/hwmon/emc2305.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
index 60809289f816..b0f2318c97e3 100644
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -593,10 +593,8 @@ static int emc2305_probe_childs_from_dt(struct device *dev)
 	for_each_child_of_node(dev->of_node, child) {
 		if (of_property_present(child, "reg")) {
 			ret = emc2305_of_parse_pwm_child(dev, child, data);
-			if (ret) {
-				of_node_put(child);
+			if (ret)
 				continue;
-			}
 			count++;
 		}
 	}
-- 
2.25.1
Re: [PATCH] hwmon: (emc2305): fix double put in emc2305_probe_childs_from_dt
Posted by Guenter Roeck 2 weeks ago
On Fri, Dec 05, 2025 at 10:02:41AM +0800, xiaopeitux@foxmail.com wrote:
> From: Pei Xiao <xiaopei01@kylinos.cn>
> 
> ./drivers/hwmon/emc2305.c:597:4-15: ERROR: probable double put
> 
> Device node iterators put the previous value of the index variable, so an
> explicit put causes a double put.
> 
> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>

Applied.

Thanks,
Guenter