Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-var-v1-6-1d0292802470@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Lee Jones
073f0165 6c17a9a8

+3 -5
+3 -5
drivers/leds/leds-aw2013.c
··· 263 263 264 264 static int aw2013_probe_dt(struct aw2013 *chip) 265 265 { 266 - struct device_node *np = dev_of_node(&chip->client->dev), *child; 266 + struct device_node *np = dev_of_node(&chip->client->dev); 267 267 int count, ret = 0, i = 0; 268 268 struct aw2013_led *led; 269 269 ··· 273 273 274 274 regmap_write(chip->regmap, AW2013_RSTR, AW2013_RSTR_RESET); 275 275 276 - for_each_available_child_of_node(np, child) { 276 + for_each_available_child_of_node_scoped(np, child) { 277 277 struct led_init_data init_data = {}; 278 278 u32 source; 279 279 u32 imax; ··· 304 304 305 305 ret = devm_led_classdev_register_ext(&chip->client->dev, 306 306 &led->cdev, &init_data); 307 - if (ret < 0) { 308 - of_node_put(child); 307 + if (ret < 0) 309 308 return ret; 310 - } 311 309 312 310 i++; 313 311 }