Skip to content

Commit 15f0395

Browse files
committed
thermal: of: Simplify thermal_of_should_bind with scoped for each OF child
JIRA: https://issues.redhat.com/browse/RHEL-79821 commit 69f3aa6 Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Date: Thu Oct 10 20:06:17 2024 +0200 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> Signed-off-by: David Arcari <darcari@redhat.com>
1 parent 80b183e commit 15f0395

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
@@ -301,7 +301,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
301301
struct thermal_cooling_device *cdev,
302302
struct cooling_spec *c)
303303
{
304-
struct device_node *tz_np, *cm_np, *child;
304+
struct device_node *tz_np, *cm_np;
305305
bool result = false;
306306

307307
tz_np = thermal_of_zone_get_by_name(tz);
@@ -315,7 +315,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
315315
goto out;
316316

317317
/* Look up the trip and the cdev in the cooling maps. */
318-
for_each_child_of_node(cm_np, child) {
318+
for_each_child_of_node_scoped(cm_np, child) {
319319
struct device_node *tr_np;
320320
int count, i;
321321

@@ -334,7 +334,6 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
334334
break;
335335
}
336336

337-
of_node_put(child);
338337
break;
339338
}
340339

0 commit comments

Comments
 (0)