summaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-02-01 14:41:42 +0100
committerBjorn Helgaas <bhelgaas@google.com>2017-02-10 16:05:06 -0600
commit862290f9e23c39051e59bf12ce65707a8ec8b911 (patch)
tree992c822cae2bf5a70159fdf044732c4e6baf3b0b /drivers/pci/msi.c
parent699c4cec238731a4c466f73fe6e9e45ab6f49a41 (diff)
downloadlinux-862290f9e23c39051e59bf12ce65707a8ec8b911.tar.gz
linux-862290f9e23c39051e59bf12ce65707a8ec8b911.tar.bz2
linux-862290f9e23c39051e59bf12ce65707a8ec8b911.zip
PCI/MSI: Check that we have a legacy interrupt line before using it
It seems like there are some devices (e.g. the PCIe root port driver) that may not always have a INTx interrupt. Check for dev->irq before returning a legacy interrupt in pci_irq_alloc_vectors to properly handle this case. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index b44ad7c21b29..52ac675f0bd7 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1198,9 +1198,11 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
}
/* use legacy irq if allowed */
- if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1) {
- pci_intx(dev, 1);
- return 1;
+ if (flags & PCI_IRQ_LEGACY) {
+ if (min_vecs == 1 && dev->irq) {
+ pci_intx(dev, 1);
+ return 1;
+ }
}
return vecs;