]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
leds: lp55xx: Simplify with scoped for each OF child loop
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Fri, 16 Aug 2024 15:31:42 +0000 (17:31 +0200)
committerLee Jones <lee@kernel.org>
Thu, 22 Aug 2024 13:23:06 +0000 (14:23 +0100)
Use scoped for_each_available_child_of_node_scoped() when iterating over
device nodes to make code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-var-v1-10-1d0292802470@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/leds-lp55xx-common.c

index 29e7142dca7281a61b55f9ad766cbee6ed859d4c..d493b31c215a0459cab9d1de59b08f6becbb8165 100644 (file)
@@ -1173,16 +1173,13 @@ static int lp55xx_parse_multi_led(struct device_node *np,
                                  struct lp55xx_led_config *cfg,
                                  int child_number)
 {
-       struct device_node *child;
        int num_colors = 0, ret;
 
-       for_each_available_child_of_node(np, child) {
+       for_each_available_child_of_node_scoped(np, child) {
                ret = lp55xx_parse_multi_led_child(child, cfg, child_number,
                                                   num_colors);
-               if (ret) {
-                       of_node_put(child);
+               if (ret)
                        return ret;
-               }
                num_colors++;
        }