From: Vladimir Oltean Date: Thu, 4 Jan 2024 14:00:30 +0000 (+0200) Subject: net: dsa: lantiq_gswip: ignore MDIO buses disabled in OF X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7a898539391dccce00c3cb24d96a6ba80cef7f6d;p=linux.git net: dsa: lantiq_gswip: ignore MDIO buses disabled in OF If the "lantiq,xrx200-mdio" child has status = "disabled", the MDIO bus creation should be avoided. Use of_device_is_available() to check for that, and take advantage of 2 facts: - of_device_is_available(NULL) returns false - of_node_put(NULL) is a no-op Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index a514e6c78c385..de48b194048f1 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -510,11 +510,11 @@ static int gswip_mdio(struct gswip_priv *priv) struct device_node *mdio_np, *switch_np = priv->dev->of_node; struct device *dev = priv->dev; struct mii_bus *bus; - int err; + int err = 0; mdio_np = of_get_compatible_child(switch_np, "lantiq,xrx200-mdio"); - if (!mdio_np) - return 0; + if (!of_device_is_available(mdio_np)) + goto out_put_node; bus = devm_mdiobus_alloc(dev); if (!bus) {