]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 10 May 2022 03:13:16 +0000 (11:13 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 11 May 2022 02:12:57 +0000 (19:12 -0700)
Switch to using pcim_enable_device() to avoid missing pci_disable_device().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220510031316.1780409-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c

index fcf17d8a0494b7a464e2e704bf049d44738640fe..644bb54f5f0204bc117e112810603eccef1a1b7b 100644 (file)
@@ -181,7 +181,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
                return -ENOMEM;
 
        /* Enable pci device */
-       ret = pci_enable_device(pdev);
+       ret = pcim_enable_device(pdev);
        if (ret) {
                dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n",
                        __func__);
@@ -241,8 +241,6 @@ static void stmmac_pci_remove(struct pci_dev *pdev)
                pcim_iounmap_regions(pdev, BIT(i));
                break;
        }
-
-       pci_disable_device(pdev);
 }
 
 static int __maybe_unused stmmac_pci_suspend(struct device *dev)