Merge branch 'pci/msi'

- Forward MSI-X error code in pci_alloc_irq_vectors_affinity() (Piotr
  Stankiewicz)

* pci/msi:
  PCI/MSI: Forward MSI-X error code in pci_alloc_irq_vectors_affinity()
This commit is contained in:
Bjorn Helgaas 2020-08-05 18:24:16 -05:00
commit d697552f52

View File

@ -1191,8 +1191,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
struct irq_affinity *affd) struct irq_affinity *affd)
{ {
struct irq_affinity msi_default_affd = {0}; struct irq_affinity msi_default_affd = {0};
int msix_vecs = -ENOSPC; int nvecs = -ENOSPC;
int msi_vecs = -ENOSPC;
if (flags & PCI_IRQ_AFFINITY) { if (flags & PCI_IRQ_AFFINITY) {
if (!affd) if (!affd)
@ -1203,17 +1202,16 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
} }
if (flags & PCI_IRQ_MSIX) { if (flags & PCI_IRQ_MSIX) {
msix_vecs = __pci_enable_msix_range(dev, NULL, min_vecs, nvecs = __pci_enable_msix_range(dev, NULL, min_vecs, max_vecs,
max_vecs, affd, flags); affd, flags);
if (msix_vecs > 0) if (nvecs > 0)
return msix_vecs; return nvecs;
} }
if (flags & PCI_IRQ_MSI) { if (flags & PCI_IRQ_MSI) {
msi_vecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, nvecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, affd);
affd); if (nvecs > 0)
if (msi_vecs > 0) return nvecs;
return msi_vecs;
} }
/* use legacy IRQ if allowed */ /* use legacy IRQ if allowed */
@ -1231,9 +1229,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
} }
} }
if (msix_vecs == -ENOSPC) return nvecs;
return -ENOSPC;
return msi_vecs;
} }
EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity); EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity);