From: Johannes Berg <johannes.berg@xxxxxxxxx> When the module fails to initialize for some reason, it doesn't clean up properly. Fix that. Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx> --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index e14811ca75b3..2c7a3709a19f 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -1746,7 +1746,7 @@ IWL_EXPORT_SYMBOL(iwl_opmode_deregister); static int __init iwl_drv_init(void) { - int i; + int i, err; mutex_init(&iwlwifi_opmode_table_mtx); @@ -1761,7 +1761,17 @@ static int __init iwl_drv_init(void) iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL); #endif - return iwl_pci_register_driver(); + err = iwl_pci_register_driver(); + if (err) + goto cleanup_debugfs; + + return 0; + +cleanup_debugfs: +#ifdef CONFIG_IWLWIFI_DEBUGFS + debugfs_remove_recursive(iwl_dbgfs_root); +#endif + return err; } module_init(iwl_drv_init); -- 2.20.1