[PATCH -next] thermal/of: Fix duplicate of_node_put()
From: Jinjie Ruan
Date: Fri Aug 23 2024 - 03:09:54 EST
In for_each_child_of_node(), if continue, of_node_put(prev) will be
called by __of_get_next_child(), so remove the duplicate
of_node_put(child).
Fixes: 0f0a1b4ba3e4 ("thermal/of: Use the .should_bind() thermal zone callback")
Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
---
drivers/thermal/thermal_of.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index dc43f50db890..85e7e3c43c7e 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -319,10 +319,8 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
int count, i;
tr_np = of_parse_phandle(child, "trip", 0);
- if (tr_np != trip->priv) {
- of_node_put(child);
+ if (tr_np != trip->priv)
continue;
- }
/* The trip has been found, look up the cdev. */
count = of_count_phandle_with_args(child, "cooling-device", "#cooling-cells");
--
2.34.1