summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/sja1105
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-06-02 15:58:35 +0200
committerDavid S. Miller <davem@davemloft.net>2023-06-05 12:26:02 +0200
commit9607eaadba68732b76c744bd22635fb1da5a7622 (patch)
tree126a8eb07a5163212e8d5037bae1a36bd6f6a28f /drivers/net/dsa/sja1105
parentMerge branch 'regmap-TSE-PCS' (diff)
downloadlinux-9607eaadba68732b76c744bd22635fb1da5a7622.tar.xz
linux-9607eaadba68732b76c744bd22635fb1da5a7622.zip
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: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/sja1105')
-rw-r--r--drivers/net/dsa/sja1105/sja1105_mdio.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
index 01f1cb719042..166fe747f70a 100644
--- a/drivers/net/dsa/sja1105/sja1105_mdio.c
+++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
@@ -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 @@ out_pcs_free:
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;
}