diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 513aaf4c5d9b..d5444d01ff50 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -12545,28 +12545,76 @@ static void wlan_hdd_state_ctrl_param_destroy(void) } /** - * component_init - API to init cld component's + * hdd_component_init() - Initialize all components * - * Return: None + * Return: QDF_STATUS */ -static void component_init(void) +static QDF_STATUS hdd_component_init(void) { - ucfg_mlme_init(); - ucfg_fwol_init(); - disa_init(); - pmo_init(); - ucfg_ocb_init(); - ipa_init(); - ucfg_action_oui_init(); + QDF_STATUS status; + + /* initialize converged components */ + status = dispatcher_init(); + if (QDF_IS_STATUS_ERROR(status)) + return status; + + /* initialize non-converged components */ + status = ucfg_mlme_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto dispatcher_deinit; + + status = ucfg_fwol_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto mlme_deinit; + + status = disa_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto fwol_deinit; + + status = pmo_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto disa_deinit; + + status = ucfg_ocb_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto pmo_deinit; + + status = ipa_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto ocb_deinit; + + status = ucfg_action_oui_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto ipa_deinit; + + return QDF_STATUS_SUCCESS; + +ipa_deinit: + ipa_deinit(); +ocb_deinit: + ucfg_ocb_deinit(); +pmo_deinit: + pmo_deinit(); +disa_deinit: + disa_deinit(); +fwol_deinit: + ucfg_fwol_deinit(); +mlme_deinit: + ucfg_mlme_deinit(); +dispatcher_deinit: + dispatcher_deinit(); + + return status; } /** - * component_deinit - API to deinit cld component's + * hdd_component_deinit() - Deinitialize all components * * Return: None */ -static void component_deinit(void) +static void hdd_component_deinit(void) { + /* deinitialize non-converged components */ ucfg_action_oui_deinit(); ipa_deinit(); ucfg_ocb_deinit(); @@ -12574,6 +12622,9 @@ static void component_deinit(void) disa_deinit(); ucfg_fwol_deinit(); ucfg_mlme_deinit(); + + /* deinitialize converged components */ + dispatcher_deinit(); } QDF_STATUS hdd_component_psoc_open(struct wlan_objmgr_psoc *psoc) @@ -12632,6 +12683,7 @@ void hdd_component_pdev_close(struct wlan_objmgr_pdev *pdev) */ static int __hdd_module_init(void) { + QDF_STATUS status; int ret = 0; pr_err("%s: Loading driver v%s (%s)\n", @@ -12647,10 +12699,11 @@ static int __hdd_module_init(void) goto err_hdd_init; } - dispatcher_init(); - - /* Ensure to call post objmgr init */ - component_init(); + status = hdd_component_init(); + if (QDF_IS_STATUS_ERROR(status)) { + ret = qdf_status_to_os_return(status); + goto hdd_deinit; + } qdf_wake_lock_create(&wlan_wake_lock, "wlan"); @@ -12672,14 +12725,17 @@ static int __hdd_module_init(void) pr_info("%s: driver loaded\n", WLAN_MODULE_NAME); return 0; + out: qdf_wake_lock_destroy(&wlan_wake_lock); - component_deinit(); - dispatcher_deinit(); + hdd_component_deinit(); + +hdd_deinit: hdd_deinit(); err_hdd_init: pld_deinit(); + return ret; } @@ -12712,10 +12768,7 @@ static void __hdd_module_exit(void) qdf_wake_lock_destroy(&wlan_wake_lock); - /* Ensure to call prior to objmgr deinit */ - component_deinit(); - - dispatcher_deinit(); + hdd_component_deinit(); hdd_sysfs_destroy_version_interface();