iwlwifi: fix module init error paths

When the module fails to initialize for some reason, it
doesn't clean up properly. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
Johannes Berg 2019-05-10 12:35:17 +02:00 committed by Luca Coelho
parent 5cc74f65a9
commit ee3399e523

View File

@ -1745,7 +1745,7 @@ IWL_EXPORT_SYMBOL(iwl_opmode_deregister);
static int __init iwl_drv_init(void) static int __init iwl_drv_init(void)
{ {
int i; int i, err;
mutex_init(&iwlwifi_opmode_table_mtx); mutex_init(&iwlwifi_opmode_table_mtx);
@ -1760,7 +1760,17 @@ static int __init iwl_drv_init(void)
iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL); iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL);
#endif #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); module_init(iwl_drv_init);