]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: mdio: realtek-rtl9300: use scoped device_for_each_child_node loop
authorFelix Gu <ustc.gu@gmail.com>
Sun, 5 Apr 2026 06:51:52 +0000 (14:51 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 9 Apr 2026 01:42:08 +0000 (18:42 -0700)
Switch to device_for_each_child_node_scoped() to auto-release fwnode
references on early exit.

Fixes: 24e31e474769 ("net: mdio: Add RTL9300 MDIO driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20260405-rtl9300-v1-1-08e4499cf944@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/mdio/mdio-realtek-rtl9300.c

index 405a07075dd115dd1802ca4acce7603ca107c27f..8d5fb014ca06c4540c5d573ebfb857f9025fb5f3 100644 (file)
@@ -466,7 +466,6 @@ static int rtl9300_mdiobus_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct rtl9300_mdio_priv *priv;
-       struct fwnode_handle *child;
        int err;
 
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -487,7 +486,7 @@ static int rtl9300_mdiobus_probe(struct platform_device *pdev)
        if (err)
                return err;
 
-       device_for_each_child_node(dev, child) {
+       device_for_each_child_node_scoped(dev, child) {
                err = rtl9300_mdiobus_probe_one(dev, priv, child);
                if (err)
                        return err;