Commit 9607eaad authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by David S. Miller
Browse files

net: dsa: sja1105: allow XPCS to handle mdiodev lifetime



Put the mdiodev after xpcs_create() so that the XPCS driver can manage
the lifetime of the mdiodev its using.

Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f91e32de
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -417,6 +417,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
		}

		xpcs = xpcs_create(mdiodev, priv->phy_mode[port]);
		mdio_device_put(mdiodev);
		if (IS_ERR(xpcs)) {
			rc = PTR_ERR(xpcs);
			goto out_pcs_free;
@@ -434,7 +435,6 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
		if (!priv->xpcs[port])
			continue;

		mdio_device_free(priv->xpcs[port]->mdiodev);
		xpcs_destroy(priv->xpcs[port]);
		priv->xpcs[port] = NULL;
	}
@@ -457,7 +457,6 @@ static void sja1105_mdiobus_pcs_unregister(struct sja1105_private *priv)
		if (!priv->xpcs[port])
			continue;

		mdio_device_free(priv->xpcs[port]->mdiodev);
		xpcs_destroy(priv->xpcs[port]);
		priv->xpcs[port] = NULL;
	}