Skip to content

Commit

Permalink
xgene-v2: Fix a resource leak in the error handling path of 'xge_prob…
Browse files Browse the repository at this point in the history
…e()'

A successful 'xge_mdio_config()' call should be balanced by a corresponding
'xge_mdio_remove()' call in the error handling path of the probe, as
already done in the remove function.

Update the error handling path accordingly.

Fixes: ea8ab16 ("drivers: net: xgene-v2: Add MDIO support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christophe JAILLET authored and David S. Miller committed Aug 23, 2021
1 parent 9cf448c commit 5ed74b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/apm/xgene-v2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,13 @@ static int xge_probe(struct platform_device *pdev)
ret = register_netdev(ndev);
if (ret) {
netdev_err(ndev, "Failed to register netdev\n");
goto err;
goto err_mdio_remove;
}

return 0;

err_mdio_remove:
xge_mdio_remove(ndev);
err:
free_netdev(ndev);

Expand Down

0 comments on commit 5ed74b0

Please sign in to comment.