]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: dsa: sja1105: Use of_get_available_child_by_name()
authorBiju Das <biju.das.jz@bp.renesas.com>
Wed, 5 Feb 2025 12:42:23 +0000 (12:42 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Feb 2025 13:43:55 +0000 (13:43 +0000)
Use the helper of_get_available_child_by_name() to simplify
sja1105_mdiobus_register().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_mdio.c

index 84b7169f297480db1ede1c04c79fae82fe9f4580..8d535c033cef7379518f9b0916d92dd8e1f41968 100644 (file)
@@ -468,13 +468,10 @@ int sja1105_mdiobus_register(struct dsa_switch *ds)
        if (rc)
                return rc;
 
-       mdio_node = of_get_child_by_name(switch_node, "mdios");
+       mdio_node = of_get_available_child_by_name(switch_node, "mdios");
        if (!mdio_node)
                return 0;
 
-       if (!of_device_is_available(mdio_node))
-               goto out_put_mdio_node;
-
        if (regs->mdio_100base_tx != SJA1105_RSV_ADDR) {
                rc = sja1105_mdiobus_base_tx_register(priv, mdio_node);
                if (rc)
@@ -487,7 +484,6 @@ int sja1105_mdiobus_register(struct dsa_switch *ds)
                        goto err_free_base_tx_mdiobus;
        }
 
-out_put_mdio_node:
        of_node_put(mdio_node);
 
        return 0;