Skip to content

Commit fb620ae

Browse files
damien-lemoalbjorn-helgaas
authored andcommitted
misc: pci_endpoint_test: Re-init completion for every test
The irq_raised completion used to detect the end of a test case is initialized when the test device is probed, but never reinitialized again before a test case. As a result, the irq_raised completion synchronization is effective only for the first ioctl test case executed. Any subsequent call to wait_for_completion() by another ioctl() call will immediately return, potentially too early, leading to false positive failures. Fix this by reinitializing the irq_raised completion before starting a new ioctl() test command. Link: https://lore.kernel.org/r/[email protected] Fixes: 2c156ac ("misc: Add host side PCI driver for PCI test function device") Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Cc: [email protected]
1 parent f61b763 commit fb620ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/misc/pci_endpoint_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,10 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
729729
struct pci_dev *pdev = test->pdev;
730730

731731
mutex_lock(&test->mutex);
732+
733+
reinit_completion(&test->irq_raised);
734+
test->last_irq = -ENODATA;
735+
732736
switch (cmd) {
733737
case PCITEST_BAR:
734738
bar = arg;

0 commit comments

Comments
 (0)