kernel panic becase pci register more than once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
When I enable pci msi or msix more than once, the kernel will panic.
Now we just use the WARN_ON, should we add check for that has been
enabled.

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index f2ef896..324840f 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -958,7 +958,9 @@ static int __pci_enable_msix(struct pci_dev *dev,
struct msix_entry *entries,
                        }
                }
        }
-       WARN_ON(!!dev->msix_enabled);
+
+       if (dev->msix_enabled)
+               return -EINVAL;

        /* Check whether driver already requested for MSI irq */
        if (dev->msi_enabled) {
@@ -1028,7 +1030,8 @@ static int __pci_enable_msi_range(struct pci_dev
*dev, int minvec, int maxvec,
        if (!pci_msi_supported(dev, minvec))
                return -EINVAL;

-       WARN_ON(!!dev->msi_enabled);
+       if (dev->msi_enabled)
+               return -EINVAL;

        /* Check whether driver already requested MSI-X irqs */
        if (dev->msix_enabled) {



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux