Skip to content

Commit 69f3aa6

Browse files
krzkrafaeljw
authored andcommitted
thermal: of: Simplify thermal_of_should_bind with scoped for each OF child
Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20241010-b4-cleanup-h-of-node-put-thermal-v4-1-bfbe29ad81f4@linaro.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ac1f43c commit 69f3aa6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/thermal/thermal_of.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
297297
struct thermal_cooling_device *cdev,
298298
struct cooling_spec *c)
299299
{
300-
struct device_node *tz_np, *cm_np, *child;
300+
struct device_node *tz_np, *cm_np;
301301
bool result = false;
302302

303303
tz_np = thermal_of_zone_get_by_name(tz);
@@ -311,7 +311,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
311311
goto out;
312312

313313
/* Look up the trip and the cdev in the cooling maps. */
314-
for_each_child_of_node(cm_np, child) {
314+
for_each_child_of_node_scoped(cm_np, child) {
315315
struct device_node *tr_np;
316316
int count, i;
317317

@@ -330,7 +330,6 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
330330
break;
331331
}
332332

333-
of_node_put(child);
334333
break;
335334
}
336335

0 commit comments

Comments
 (0)