mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
net: ethernet: Fix memleak in ethoc_probe
[ Upstream commit 5d41f9b7ee7a5a5138894f58846a4ffed601498a ]
When mdiobus_register() fails, priv->mdio allocated
by mdiobus_alloc() has not been freed, which leads
to memleak.
Fixes: e7f4dc3536 ("mdio: Move allocation of interrupts into core")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20201223110615.31389-1-dinghao.liu@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
56dc7908ed
commit
e43ec45d45
1 changed files with 2 additions and 1 deletions
|
|
@ -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 free3;
|
||||
}
|
||||
|
||||
ret = ethoc_mdio_probe(netdev);
|
||||
|
|
@ -1239,6 +1239,7 @@ error2:
|
|||
netif_napi_del(&priv->napi);
|
||||
error:
|
||||
mdiobus_unregister(priv->mdio);
|
||||
free3:
|
||||
mdiobus_free(priv->mdio);
|
||||
free2:
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
|
|
|||
Loading…
Reference in a new issue