Blob Blame History Raw
From acaef7981a218813e3617edb9c01837808de063c Mon Sep 17 00:00:00 2001
From: Yang Yingliang <yangyingliang@huawei.com>
Date: Wed, 31 Mar 2021 16:40:12 +0800
Subject: [PATCH] PCI: endpoint: Fix missing destroy_workqueue()
Git-commit: acaef7981a218813e3617edb9c01837808de063c
References: git-fixes
Patch-mainline: v5.13-rc1

Add the missing destroy_workqueue() before return from
pci_epf_test_init() in the error handling case and add
destroy_workqueue() in pci_epf_test_exit().

Link: https://lore.kernel.org/r/20210331084012.2091010-1-yangyingliang@huawei.com
Fixes: 349e7a85b25fa ("PCI: endpoint: functions: Add an EP function to test PCI")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/pci/endpoint/functions/pci-epf-test.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -491,6 +491,7 @@ static int __init pci_epf_test_init(void
 					     WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
 	ret = pci_epf_register_driver(&test_driver);
 	if (ret) {
+		destroy_workqueue(kpcitest_workqueue);
 		pr_err("failed to register pci epf test driver --> %d\n", ret);
 		return ret;
 	}
@@ -501,6 +502,8 @@ module_init(pci_epf_test_init);
 
 static void __exit pci_epf_test_exit(void)
 {
+	if (kpcitest_workqueue)
+		destroy_workqueue(kpcitest_workqueue);
 	pci_epf_unregister_driver(&test_driver);
 }
 module_exit(pci_epf_test_exit);