diff mbox series

[-next] thermal/of: Fix duplicate of_node_put()

Message ID 20240823071555.3331632-1-ruanjinjie@huawei.com
State New
Headers show
Series [-next] thermal/of: Fix duplicate of_node_put() | expand

Commit Message

Jinjie Ruan Aug. 23, 2024, 7:15 a.m. UTC
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@huawei.com>
---
 drivers/thermal/thermal_of.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

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");