From 804a3709242c14c911c1a4f86316cef830d579a0 Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Mon, 21 Sep 2020 18:11:34 -0700 Subject: [PATCH] qcacld-3.0: Set num_dbs_hw_modes to 0 on malloc failure Set num_dbs_hw_modes to 0 on malloc failure. Change-Id: I29c1a54b290892c149c2c84250042a7115a1d07a CRs-Fixed: 2781988 --- .../policy_mgr/src/wlan_policy_mgr_get_set_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index c7dabf1fddb8..c6742085a1a0 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -669,7 +669,8 @@ QDF_STATUS policy_mgr_update_hw_mode_list(struct wlan_objmgr_psoc *psoc, pm_ctx->num_dbs_hw_modes); if (!pm_ctx->hw_mode.hw_mode_list) { policy_mgr_err("Memory allocation failed for DBS"); - return QDF_STATUS_E_FAILURE; + pm_ctx->num_dbs_hw_modes = 0; + return QDF_STATUS_E_NOMEM; } policy_mgr_debug("Updated HW mode list: Num modes:%d", @@ -726,6 +727,7 @@ void policy_mgr_init_dbs_hw_mode(struct wlan_objmgr_psoc *psoc, pm_ctx->num_dbs_hw_modes); if (!pm_ctx->hw_mode.hw_mode_list) { policy_mgr_err("Memory allocation failed for DBS"); + pm_ctx->num_dbs_hw_modes = 0; return; } qdf_mem_copy(pm_ctx->hw_mode.hw_mode_list,