Skip to content

Commit 9607eaa

Browse files
Russell King (Oracle)davem330
authored andcommitted
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>
1 parent f91e32d commit 9607eaa

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/net/dsa/sja1105/sja1105_mdio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
417417
}
418418

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

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

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

0 commit comments

Comments
 (0)