diff options
author | Christoph Hellwig <hch@lst.de> | 2017-02-01 08:41:42 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-02-10 17:05:06 -0500 |
commit | 862290f9e23c39051e59bf12ce65707a8ec8b911 (patch) | |
tree | 992c822cae2bf5a70159fdf044732c4e6baf3b0b | |
parent | 699c4cec238731a4c466f73fe6e9e45ab6f49a41 (diff) |
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>
-rw-r--r-- | drivers/pci/msi.c | 8 |
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, | |||
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | /* use legacy irq if allowed */ | 1200 | /* use legacy irq if allowed */ |
1201 | if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1) { | 1201 | if (flags & PCI_IRQ_LEGACY) { |
1202 | pci_intx(dev, 1); | 1202 | if (min_vecs == 1 && dev->irq) { |
1203 | return 1; | 1203 | pci_intx(dev, 1); |
1204 | return 1; | ||
1205 | } | ||
1204 | } | 1206 | } |
1205 | 1207 | ||
1206 | return vecs; | 1208 | return vecs; |