summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>2025-12-24 13:45:22 +0100
committerLee Jones <lee@kernel.org>2026-02-04 09:20:56 +0000
commit207a693835d48f92994fc23d8c3e4f131acbb73a (patch)
tree98dc4a5ceeb2927262ef5b7e5de64d7122e2d606 /drivers/leds
parent2fe4df9fa931812fdfa6624944adf269db7fad96 (diff)
downloadlinux-next-207a693835d48f92994fc23d8c3e4f131acbb73a.tar.gz
linux-next-207a693835d48f92994fc23d8c3e4f131acbb73a.zip
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>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lp55xx-common.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index fd447eb7eb15..ea131177de96 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -1204,7 +1204,6 @@ static struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
struct device_node *np,
struct lp55xx_chip *chip)
{
- struct device_node *child;
struct lp55xx_platform_data *pdata;
struct lp55xx_led_config *cfg;
int num_channels;
@@ -1229,12 +1228,10 @@ static struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
pdata->num_channels = num_channels;
cfg->max_channel = chip->cfg->max_channel;
- for_each_available_child_of_node(np, child) {
+ for_each_available_child_of_node_scoped(np, child) {
ret = lp55xx_parse_logical_led(child, cfg, i);
- if (ret) {
- of_node_put(child);
+ if (ret)
return ERR_PTR(-EINVAL);
- }
i++;
}