Commit 073f0165 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Lee Jones

leds: aw2013: 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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-var-v1-6-1d0292802470@linaro.orgSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 6c17a9a8
...@@ -263,7 +263,7 @@ static int aw2013_blink_set(struct led_classdev *cdev, ...@@ -263,7 +263,7 @@ static int aw2013_blink_set(struct led_classdev *cdev,
static int aw2013_probe_dt(struct aw2013 *chip) static int aw2013_probe_dt(struct aw2013 *chip)
{ {
struct device_node *np = dev_of_node(&chip->client->dev), *child; struct device_node *np = dev_of_node(&chip->client->dev);
int count, ret = 0, i = 0; int count, ret = 0, i = 0;
struct aw2013_led *led; struct aw2013_led *led;
...@@ -273,7 +273,7 @@ static int aw2013_probe_dt(struct aw2013 *chip) ...@@ -273,7 +273,7 @@ static int aw2013_probe_dt(struct aw2013 *chip)
regmap_write(chip->regmap, AW2013_RSTR, AW2013_RSTR_RESET); regmap_write(chip->regmap, AW2013_RSTR, AW2013_RSTR_RESET);
for_each_available_child_of_node(np, child) { for_each_available_child_of_node_scoped(np, child) {
struct led_init_data init_data = {}; struct led_init_data init_data = {};
u32 source; u32 source;
u32 imax; u32 imax;
...@@ -304,10 +304,8 @@ static int aw2013_probe_dt(struct aw2013 *chip) ...@@ -304,10 +304,8 @@ static int aw2013_probe_dt(struct aw2013 *chip)
ret = devm_led_classdev_register_ext(&chip->client->dev, ret = devm_led_classdev_register_ext(&chip->client->dev,
&led->cdev, &init_data); &led->cdev, &init_data);
if (ret < 0) { if (ret < 0)
of_node_put(child);
return ret; return ret;
}
i++; i++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment