Skip to content

Commit 207a693

Browse files
krzklag-linaro
authored andcommitted
leds: lp55xx: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20251224124521.208635-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 2fe4df9 commit 207a693

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/leds/leds-lp55xx-common.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,6 @@ static struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
12041204
struct device_node *np,
12051205
struct lp55xx_chip *chip)
12061206
{
1207-
struct device_node *child;
12081207
struct lp55xx_platform_data *pdata;
12091208
struct lp55xx_led_config *cfg;
12101209
int num_channels;
@@ -1229,12 +1228,10 @@ static struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
12291228
pdata->num_channels = num_channels;
12301229
cfg->max_channel = chip->cfg->max_channel;
12311230

1232-
for_each_available_child_of_node(np, child) {
1231+
for_each_available_child_of_node_scoped(np, child) {
12331232
ret = lp55xx_parse_logical_led(child, cfg, i);
1234-
if (ret) {
1235-
of_node_put(child);
1233+
if (ret)
12361234
return ERR_PTR(-EINVAL);
1237-
}
12381235
i++;
12391236
}
12401237

0 commit comments

Comments
 (0)