In ethoc_probe, a failure of mdiobus_register() does not release
the memory allocated by mdiobus_alloc. The patch fixes this issue.

Signed-off-by: Aditya Pakki <pakki...@umn.edu>
---
 drivers/net/ethernet/ethoc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index a817ca661c1f..2f6bab9f1d71 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1207,7 +1207,7 @@ static int ethoc_probe(struct platform_device *pdev)
        ret = mdiobus_register(priv->mdio);
        if (ret) {
                dev_err(&netdev->dev, "failed to register MDIO bus\n");
-               goto free2;
+               goto free_mdio;
        }
 
        ret = ethoc_mdio_probe(netdev);
@@ -1239,6 +1239,7 @@ static int ethoc_probe(struct platform_device *pdev)
        netif_napi_del(&priv->napi);
 error:
        mdiobus_unregister(priv->mdio);
+free_mdio:
        mdiobus_free(priv->mdio);
 free2:
        clk_disable_unprepare(priv->clk);
-- 
2.25.1

Reply via email to