From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 15:31:37 +0000 (+0200) Subject: leds: 88pm860x: Simplify with scoped for each OF child loop X-Git-Tag: v6.12-rc1~87^2~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c17a9a8991cf1f4e0767c2a8b3c110ea34e1019;p=thirdparty%2Fkernel%2Flinux.git leds: 88pm860x: 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 Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-var-v1-5-1d0292802470@linaro.org Signed-off-by: Lee Jones --- diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c index 033ab5fed38a4..81238376484be 100644 --- a/drivers/leds/leds-88pm860x.c +++ b/drivers/leds/leds-88pm860x.c @@ -115,7 +115,7 @@ static int pm860x_led_set(struct led_classdev *cdev, static int pm860x_led_dt_init(struct platform_device *pdev, struct pm860x_led *data) { - struct device_node *nproot, *np; + struct device_node *nproot; int iset = 0; if (!dev_of_node(pdev->dev.parent)) @@ -125,12 +125,11 @@ static int pm860x_led_dt_init(struct platform_device *pdev, dev_err(&pdev->dev, "failed to find leds node\n"); return -ENODEV; } - for_each_available_child_of_node(nproot, np) { + for_each_available_child_of_node_scoped(nproot, np) { if (of_node_name_eq(np, data->name)) { of_property_read_u32(np, "marvell,88pm860x-iset", &iset); data->iset = PM8606_LED_CURRENT(iset); - of_node_put(np); break; } }