diff options
| author | Houston Hoffman <hhoffman@codeaurora.org> | 2016-10-10 17:37:51 -0700 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-10-20 16:04:28 -0700 |
| commit | 160db394b30aca301ee75cf323650a89ea8da8f6 (patch) | |
| tree | c212f5ee2b2fc8d0f8185178beb06ebfe59088dc | |
| parent | 6640cf3cbef260802b1b9032d52dcc833e0b696a (diff) | |
qcacld-3.0: use hdd_context_deinit in hdd_context_destroy
Using hdd_context_deinit in hdd_context_destroy reduces redundant code
and ensures that wlan_hdd_cfg80211_deinit is called in all
error casesses.
Change-Id: I7cb98d2934213446c6453e310a3883ffb653f1e6
CRs-Fixed: 1079503
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 97213841f769..affac218eac9 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -4747,17 +4747,18 @@ static void hdd_roc_context_destroy(hdd_context_t *hdd_ctx) } /** - * hdd_context_destroy() - Destroy HDD context - * @hdd_ctx: HDD context to be destroyed. + * hdd_context_deinit() - Deinitialize HDD context + * @hdd_ctx: HDD context. * - * Free config and HDD context as well as destroy all the resources. + * Deinitialize HDD context along with all the feature specific contexts but + * do not free hdd context itself. Caller of this API is supposed to free + * HDD context. * - * Return: None + * return: 0 on success and errno on failure. */ -static void hdd_context_destroy(hdd_context_t *hdd_ctx) +static int hdd_context_deinit(hdd_context_t *hdd_ctx) { - if (QDF_GLOBAL_FTM_MODE != hdd_get_conparam()) - hdd_logging_sock_deactivate_svc(hdd_ctx); + wlan_hdd_cfg80211_deinit(hdd_ctx->wiphy); hdd_roc_context_destroy(hdd_ctx); @@ -4771,6 +4772,24 @@ static void hdd_context_destroy(hdd_context_t *hdd_ctx) qdf_list_destroy(&hdd_ctx->hddAdapters); + return 0; +} + +/** + * hdd_context_destroy() - Destroy HDD context + * @hdd_ctx: HDD context to be destroyed. + * + * Free config and HDD context as well as destroy all the resources. + * + * Return: None + */ +static void hdd_context_destroy(hdd_context_t *hdd_ctx) +{ + if (QDF_GLOBAL_FTM_MODE != hdd_get_conparam()) + hdd_logging_sock_deactivate_svc(hdd_ctx); + + hdd_context_deinit(hdd_ctx); + qdf_mem_free(hdd_ctx->config); hdd_ctx->config = NULL; @@ -6375,36 +6394,6 @@ static void hdd_set_trace_level_for_each(hdd_context_t *hdd_ctx) } /** - * hdd_context_deinit() - Deinitialize HDD context - * @hdd_ctx: HDD context. - * - * Deinitialize HDD context along with all the feature specific contexts but - * do not free hdd context itself. Caller of this API is supposed to free - * HDD context. - * - * return: 0 on success and errno on failure. - */ -static int hdd_context_deinit(hdd_context_t *hdd_ctx) -{ - wlan_hdd_cfg80211_deinit(hdd_ctx->wiphy); - - hdd_roc_context_destroy(hdd_ctx); - - hdd_sap_context_destroy(hdd_ctx); - - hdd_rx_wake_lock_destroy(hdd_ctx); - - hdd_tdls_context_destroy(hdd_ctx); - - hdd_scan_context_destroy(hdd_ctx); - - qdf_list_destroy(&hdd_ctx->hddAdapters); - - return 0; -} - - -/** * hdd_context_init() - Initialize HDD context * @hdd_ctx: HDD context. * @@ -8102,7 +8091,6 @@ err_ipa_cleanup: err_wiphy_unregister: wiphy_unregister(hdd_ctx->wiphy); - wlan_hdd_cfg80211_deinit(hdd_ctx->wiphy); err_stop_modules: hdd_wlan_stop_modules(hdd_ctx); |
