Skip to content

Commit

Permalink
net: bcmgenet: Fix a resource leak in an error handling path in the p…
Browse files Browse the repository at this point in the history
…robe functin

[ Upstream commit 4375ada ]

If the 'register_netdev()' call fails, we must undo a previous
'bcmgenet_mii_init()' call.

Fixes: 1c1008c ("net: bcmgenet: add main driver file")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20201212182005.120437-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and gregkh committed Dec 30, 2020
1 parent efc5700 commit 226bcdb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/broadcom/genet/bcmgenet.c
Expand Up @@ -3584,8 +3584,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
clk_disable_unprepare(priv->clk);

err = register_netdev(dev);
if (err)
if (err) {
bcmgenet_mii_exit(dev);
goto err;
}

return err;

Expand Down

0 comments on commit 226bcdb

Please sign in to comment.