]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
thermal: of: Simplify thermal_of_should_bind with scoped for each OF child
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Thu, 10 Oct 2024 18:06:17 +0000 (20:06 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 26 Nov 2024 12:28:43 +0000 (13:28 +0100)
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>
drivers/thermal/thermal_of.c

index 07e09897165f3497c9609a36f90194149f43d20c..e406b9150a2bc31a86ecd62cf1e2194dec5fd34b 100644 (file)
@@ -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;
        }