@@ -965,6 +965,8 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
rc = pci_alloc_irq_vectors(pm8001_ha->pdev, 1, 1,
PCI_IRQ_MSIX);
} else {
+ unsigned int max_vecs = min_t(unsigned int, PM8001_MAX_MSIX_VEC,
+ scsi_max_nr_hw_queues() + 1);
/*
* Queue index #0 is used always for housekeeping, so don't
* include in the affinity spreading.
@@ -973,7 +975,7 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
.pre_vectors = 1,
};
rc = pci_alloc_irq_vectors_affinity(
- pm8001_ha->pdev, 2, PM8001_MAX_MSIX_VEC,
+ pm8001_ha->pdev, 2, max_vecs,
PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, &desc);
}