On Sun, Jul 10, 2016 at 08:57:45PM +0900, Christoph Hellwig wrote: > +/** > + * pci_irq_vector - return Linux IRQ number of a device vector > + * @dev: PCI device to operate on > + * @nr: device-relative interrupt vector index (0-based). > + */ > +int pci_irq_vector(struct pci_dev *dev, unsigned int nr) > +{ > + if (dev->msix_enabled) { > + struct msi_desc *entry; > + int i = 0; > + > + for_each_pci_msi_entry(entry, dev) { > + if (i == nr) > + return entry->irq; > + i++; > + } > + WARN_ON_ONCE(1); > + return -EINVAL; > + } > + > + if (WARN_ON_ONCE(!dev->msi_enabled && nr > 0)) > + return -EINVAL; Something like this is also needed here: if (WARN_ON_ONCE(nr >= msi_desc::nvec_used)) return -EINVAL; > + return dev->irq + nr; > +} > +EXPORT_SYMBOL(pci_irq_vector); -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html