]> git.baikalelectronics.ru Git - kernel.git/commitdiff
PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
authorChristoph Hellwig <hch@lst.de>
Sat, 20 May 2017 16:59:54 +0000 (18:59 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 May 2017 15:45:56 +0000 (08:45 -0700)
We need to return an error for any call that asks for MSI / MSI-X
vectors only, so that non-trivial fallback logic can work properly.

Also valid dev->irq and use the "correct" errno value based on feedback
from Linus.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: 004715ce ("PCI: Provide sensible IRQ vector alloc/free routines")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/pci.h

index 33c2b0b77429d09aaa31cb9735458db5762e08a7..fc2e832d7b9ccf3350ee75a0d35a60e3b289b69f 100644 (file)
@@ -1342,9 +1342,9 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
                               unsigned int max_vecs, unsigned int flags,
                               const struct irq_affinity *aff_desc)
 {
-       if (min_vecs > 1)
-               return -EINVAL;
-       return 1;
+       if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)
+               return 1;
+       return -ENOSPC;
 }
 
 static inline void pci_free_irq_vectors(struct pci_dev *dev)