aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/pci_endpoint_test.c
diff options
context:
space:
mode:
authorDamien Le Moal <[email protected]>2023-04-15 02:35:40 +0000
committerBjorn Helgaas <[email protected]>2023-06-23 20:03:34 +0000
commitfb620ae73b70c2f57b9d3e911fc24c024ba2324f (patch)
treea2d3149033142ee827a006fcfe7b4222696135f7 /drivers/misc/pci_endpoint_test.c
parentmisc: pci_endpoint_test: Free IRQs before removing the device (diff)
downloadkernel-fb620ae73b70c2f57b9d3e911fc24c024ba2324f.tar.gz
kernel-fb620ae73b70c2f57b9d3e911fc24c024ba2324f.zip
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: 2c156ac71c6b ("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]
Diffstat (limited to 'drivers/misc/pci_endpoint_test.c')
-rw-r--r--drivers/misc/pci_endpoint_test.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 01235236e9bc..24efe3b88a1f 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -729,6 +729,10 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
struct pci_dev *pdev = test->pdev;
mutex_lock(&test->mutex);
+
+ reinit_completion(&test->irq_raised);
+ test->last_irq = -ENODATA;
+
switch (cmd) {
case PCITEST_BAR:
bar = arg;