]> git.baikalelectronics.ru Git - kernel.git/commitdiff
stmmac: dwmac-loongson: fix missing pci_disable_msi() while module exiting
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 8 Nov 2022 11:46:45 +0000 (19:46 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 10 Nov 2022 10:03:00 +0000 (11:03 +0100)
pci_enable_msi() has been called in loongson_dwmac_probe(),
so pci_disable_msi() needs be called in remove path and error
path of probe().

Fixes: 30bba69d7db4 ("stmmac: pci: Add dwmac support for Loongson")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c

index 79fa7870563b862a8d21d183f0fb0d8288296720..16915b4d95057bc178dfd9c24e18023fff984e5c 100644 (file)
@@ -125,6 +125,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
        if (res.irq < 0) {
                dev_err(&pdev->dev, "IRQ macirq not found\n");
                ret = -ENODEV;
+               goto err_disable_msi;
        }
 
        res.wol_irq = of_irq_get_byname(np, "eth_wake_irq");
@@ -137,9 +138,18 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
        if (res.lpi_irq < 0) {
                dev_err(&pdev->dev, "IRQ eth_lpi not found\n");
                ret = -ENODEV;
+               goto err_disable_msi;
        }
 
-       return stmmac_dvr_probe(&pdev->dev, plat, &res);
+       ret = stmmac_dvr_probe(&pdev->dev, plat, &res);
+       if (ret)
+               goto err_disable_msi;
+
+       return ret;
+
+err_disable_msi:
+       pci_disable_msi(pdev);
+       return ret;
 }
 
 static void loongson_dwmac_remove(struct pci_dev *pdev)
@@ -155,6 +165,7 @@ static void loongson_dwmac_remove(struct pci_dev *pdev)
                break;
        }
 
+       pci_disable_msi(pdev);
        pci_disable_device(pdev);
 }