]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 21 Aug 2021 07:35:23 +0000 (09:35 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 1 Oct 2021 09:31:05 +0000 (11:31 +0200)
BugLink: https://bugs.launchpad.net/bugs/1944756
[ Upstream commit 5ed74b03eb4d08f5dd281dcb5f1c9bb92b363a8d ]

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: ea8ab16ab225 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/apm/xgene-v2/main.c

index 02b4f3af02b54b1f6047b06a42b5391ae8cf96e3..848be6bf2fd1f9f5fed67fefb4151992244ab247 100644 (file)
@@ -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);