[PATCH] PCI: cpqphp: Fix error handling in cpqhpc_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The cpqhpc_init() returns the result of pci_register_driver() without
checking it, if pci_register_driver() failed, the debugfs created in
cpqhp_initialize_debugfs() is not removed, resulting the debugfs of
cpqhp can never be created later.
Fix by calling cpqhp_shutdown_debugfs() when pci_register_driver() failed.

Fixes: 9f3f4681291f ("[PATCH] PCI Hotplug: fix up the sysfs file in the compaq pci hotplug driver")
Signed-off-by: Yuan Can <yuancan@xxxxxxxxxx>
---
 drivers/pci/hotplug/cpqphp_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index c94b40e64baf..c47981ef92ea 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -1389,6 +1389,8 @@ static int __init cpqhpc_init(void)
 	info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
 	cpqhp_initialize_debugfs();
 	result = pci_register_driver(&cpqhpc_driver);
+	if (result)
+		cpqhp_shutdown_debugfs();
 	dbg("pci_register_driver = %d\n", result);
 	return result;
 }
-- 
2.17.1




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux