Skip to content

Commit

Permalink
net: dsa: lantiq_gswip: ignore MDIO buses disabled in OF
Browse files Browse the repository at this point in the history
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 <vladimir.oltean@nxp.com>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Jan 5, 2024
1 parent cd4ba3e commit 7a89853
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/dsa/lantiq_gswip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7a89853

Please sign in to comment.