]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: enetc: unregister mdiobus
authorMichael Walle <michael@walle.cc>
Tue, 31 May 2022 16:36:16 +0000 (18:36 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 3 Jun 2022 15:15:24 +0000 (11:15 -0400)
If the device fails to probe - for example, when there is no
ethaddr set - then the private data is automatically freed
but the mdiobus remains registered.

Fixes: 1e354cb39314 ("drivers: net: fsl_enetc: register internal MDIO bus")
Signed-off-by: Michael Walle <michael@walle.cc>
drivers/net/fsl_enetc.c

index 9b97a03ccb3f391bc8fce22049bca1ee1073c39d..cd4c2c29a6536a5aba36c89edcda0061ab69fef3 100644 (file)
@@ -361,6 +361,9 @@ static int enetc_remove(struct udevice *dev)
 {
        struct enetc_priv *priv = dev_get_priv(dev);
 
+       if (miiphy_get_dev_by_name(priv->imdio.name))
+               mdio_unregister(&priv->imdio);
+
        free(priv->enetc_txbd);
        free(priv->enetc_rxbd);