Skip to content

Commit 9d4cfee

Browse files
krzklag-linaro
authored andcommitted
leds: lp55xx: Simplify with scoped for each OF child loop
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 2c37529 commit 9d4cfee

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/leds/leds-lp55xx-common.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,16 +1173,13 @@ static int lp55xx_parse_multi_led(struct device_node *np,
11731173
struct lp55xx_led_config *cfg,
11741174
int child_number)
11751175
{
1176-
struct device_node *child;
11771176
int num_colors = 0, ret;
11781177

1179-
for_each_available_child_of_node(np, child) {
1178+
for_each_available_child_of_node_scoped(np, child) {
11801179
ret = lp55xx_parse_multi_led_child(child, cfg, child_number,
11811180
num_colors);
1182-
if (ret) {
1183-
of_node_put(child);
1181+
if (ret)
11841182
return ret;
1185-
}
11861183
num_colors++;
11871184
}
11881185

0 commit comments

Comments
 (0)