diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 3f17581aab6c..c62eff2e0c67 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -160,7 +160,14 @@ uint8_t cds_get_datapath_handles(void **soc, struct cdp_pdev **pdev, QDF_STATUS cds_init(void) { - qdf_debugfs_init(); + QDF_STATUS ret; + + ret = qdf_debugfs_init(); + if (ret != QDF_STATUS_SUCCESS) { + cds_err("Failed to init debugfs"); + goto err_ret; + } + qdf_lock_stats_init(); qdf_mem_init(); qdf_mc_timer_manager_init(); @@ -181,9 +188,23 @@ QDF_STATUS cds_init(void) cds_ssr_protect_init(); - cds_recovery_work_init(); + ret = cds_recovery_work_init(); + if (ret != QDF_STATUS_SUCCESS) { + cds_err("Failed to init recovery work"); + goto deinit; + } - return gp_cds_context ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; + return QDF_STATUS_SUCCESS; +deinit: + qdf_mc_timer_manager_exit(); + qdf_mem_exit(); + qdf_lock_stats_deinit(); + qdf_debugfs_exit(); + gp_cds_context->qdf_ctx = NULL; + gp_cds_context = NULL; + qdf_mem_zero(&g_cds_context, sizeof(g_cds_context)); +err_ret: + return ret; } /** diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 21e97836507a..6f120a2c425f 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -11031,6 +11031,11 @@ int hdd_init(void) int ret = 0; status = cds_init(); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to allocate CDS context"); + ret = -ENOMEM; + goto err_out; + } wlan_init_bug_report_lock(); @@ -11038,12 +11043,6 @@ int hdd_init(void) wlan_logging_sock_init_svc(); #endif - if (QDF_IS_STATUS_ERROR(status)) { - hdd_err("Failed to allocate CDS context"); - ret = -ENOMEM; - goto err_out; - } - qdf_timer_init(NULL, &hdd_drv_ops_inactivity_timer, (void *)hdd_drv_ops_inactivity_handler, NULL, QDF_TIMER_TYPE_SW);