diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2024-10-10 20:06:17 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-11-26 13:28:43 +0100 |
commit | 69f3aa6ad92447d6e9f50c5b5aea85b56e80b198 (patch) | |
tree | 73f2b797839f721c51b5e65851c8e1c21d1d9d5d | |
parent | ac1f43c03fc91eee53cc95683245350d4d87781e (diff) | |
download | lwn-69f3aa6ad92447d6e9f50c5b5aea85b56e80b198.tar.gz lwn-69f3aa6ad92447d6e9f50c5b5aea85b56e80b198.zip |
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>
-rw-r--r-- | drivers/thermal/thermal_of.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 07e09897165f..e406b9150a2b 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -297,7 +297,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev, struct cooling_spec *c) { - struct device_node *tz_np, *cm_np, *child; + struct device_node *tz_np, *cm_np; bool result = false; tz_np = thermal_of_zone_get_by_name(tz); @@ -311,7 +311,7 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, goto out; /* Look up the trip and the cdev in the cooling maps. */ - for_each_child_of_node(cm_np, child) { + for_each_child_of_node_scoped(cm_np, child) { struct device_node *tr_np; int count, i; @@ -330,7 +330,6 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, break; } - of_node_put(child); break; } |