1 From 51c884291a94fd6598427d7d6c211f1f20780d57 Mon Sep 17 00:00:00 2001
2 From: Jinjie Ruan <ruanjinjie@huawei.com>
3 Date: Fri, 30 Aug 2024 11:13:19 +0800
4 Subject: [PATCH 02/12] net: dsa: realtek: Use for_each_child_of_node_scoped()
6 Avoid need to manually handle of_node_put() by using
7 for_each_child_of_node_scoped(), which can simplfy code.
9 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
10 Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
11 Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
12 Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
13 Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
14 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
15 Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
17 drivers/net/dsa/realtek/rtl8366rb.c | 8 +++-----
18 1 file changed, 3 insertions(+), 5 deletions(-)
20 --- a/drivers/net/dsa/realtek/rtl8366rb.c
21 +++ b/drivers/net/dsa/realtek/rtl8366rb.c
22 @@ -1013,8 +1013,8 @@ static int rtl8366rb_setup_all_leds_off(
24 static int rtl8366rb_setup_leds(struct realtek_priv *priv)
26 - struct device_node *leds_np, *led_np;
27 struct dsa_switch *ds = &priv->ds;
28 + struct device_node *leds_np;
32 @@ -1029,13 +1029,11 @@ static int rtl8366rb_setup_leds(struct r
36 - for_each_child_of_node(leds_np, led_np) {
37 + for_each_child_of_node_scoped(leds_np, led_np) {
38 ret = rtl8366rb_setup_led(priv, dp,
39 of_fwnode_handle(led_np));
41 - of_node_put(led_np);