Skip to content

Commit cc8e391

Browse files
bruelcMani-Sadhasivam
authored andcommitted
misc: pci_endpoint_test: Skip IRQ tests if irq is out of range
The pci_endpoint_test tests the 32-bit MSI range. However, the device might not have all vectors configured. For example, if msi_interrupts is 8 in the ep function space or if the MSI Multiple Message Capable value is configured as 4 (maximum 16 vectors). In this case, do not attempt to run the test to avoid timeouts and directly return the error value. Signed-off-by: Christian Bruel <christian.bruel@foss.st.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://patch.msgid.link/20250804170916.3212221-2-christian.bruel@foss.st.com
1 parent 27fce9e commit cc8e391

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/misc/pci_endpoint_test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ static int pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
436436
{
437437
struct pci_dev *pdev = test->pdev;
438438
u32 val;
439-
int ret;
439+
int irq;
440+
441+
irq = pci_irq_vector(pdev, msi_num - 1);
442+
if (irq < 0)
443+
return irq;
440444

441445
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
442446
msix ? PCITEST_IRQ_TYPE_MSIX :
@@ -450,11 +454,7 @@ static int pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
450454
if (!val)
451455
return -ETIMEDOUT;
452456

453-
ret = pci_irq_vector(pdev, msi_num - 1);
454-
if (ret < 0)
455-
return ret;
456-
457-
if (ret != test->last_irq)
457+
if (irq != test->last_irq)
458458
return -EIO;
459459

460460
return 0;

0 commit comments

Comments
 (0)