Merge branch 'pci/msi'
- Avoid panic when drivers enable MSI/MSI-X twice (Tonghao Zhang) * pci/msi: PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice
This commit is contained in:
commit
0af6166395
@ -958,7 +958,6 @@ static int __pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries,
|
||||
}
|
||||
}
|
||||
}
|
||||
WARN_ON(!!dev->msix_enabled);
|
||||
|
||||
/* Check whether driver already requested for MSI irq */
|
||||
if (dev->msi_enabled) {
|
||||
@ -1028,8 +1027,6 @@ 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);
|
||||
|
||||
/* Check whether driver already requested MSI-X irqs */
|
||||
if (dev->msix_enabled) {
|
||||
pci_info(dev, "can't enable MSI (MSI-X already enabled)\n");
|
||||
@ -1039,6 +1036,9 @@ static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
|
||||
if (maxvec < minvec)
|
||||
return -ERANGE;
|
||||
|
||||
if (WARN_ON_ONCE(dev->msi_enabled))
|
||||
return -EINVAL;
|
||||
|
||||
nvec = pci_msi_vec_count(dev);
|
||||
if (nvec < 0)
|
||||
return nvec;
|
||||
@ -1087,6 +1087,9 @@ static int __pci_enable_msix_range(struct pci_dev *dev,
|
||||
if (maxvec < minvec)
|
||||
return -ERANGE;
|
||||
|
||||
if (WARN_ON_ONCE(dev->msix_enabled))
|
||||
return -EINVAL;
|
||||
|
||||
for (;;) {
|
||||
if (affd) {
|
||||
nvec = irq_calc_affinity_vectors(minvec, nvec, affd);
|
||||
|
Loading…
Reference in New Issue
Block a user