Browse Source

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
Srinivas Girigowda 4 years ago
parent
commit
804a370924

+ 3 - 1
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,