Browse Source

qcacld-3.0: Reduce stack frame size while handling mc_cp_stats

Reduce stack frame size of target_if_mc_cp_stats_stats_event_handler()
by allocating dynamic memory to struct stats_event.

Change-Id: Ieaf99efece75080fe7ff6cf2cf70858ca5f8740f
CRs-Fixed: 2868456
Dundi Raviteja 4 years ago
parent
commit
f814c5b5f5
1 changed files with 11 additions and 4 deletions
  1. 11 4
      components/target_if/cp_stats/src/target_if_mc_cp_stats.c

+ 11 - 4
components/target_if/cp_stats/src/target_if_mc_cp_stats.c

@@ -850,7 +850,7 @@ static int target_if_mc_cp_stats_stats_event_handler(ol_scn_t scn,
 						     uint32_t datalen)
 {
 	QDF_STATUS status;
-	struct stats_event ev = {0};
+	struct stats_event *ev;
 	struct wlan_objmgr_psoc *psoc;
 	struct wmi_unified *wmi_handle;
 	struct wlan_lmac_if_cp_stats_rx_ops *rx_ops;
@@ -877,16 +877,23 @@ static int target_if_mc_cp_stats_stats_event_handler(ol_scn_t scn,
 		return -EINVAL;
 	}
 
-	status = target_if_cp_stats_extract_event(wmi_handle, &ev, data);
+	ev = qdf_mem_malloc(sizeof(*ev));
+	if (!ev) {
+		cp_stats_err("");
+		return -EINVAL;
+	}
+
+	status = target_if_cp_stats_extract_event(wmi_handle, ev, data);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		cp_stats_err("extract event failed");
 		goto end;
 	}
 
-	status = rx_ops->process_stats_event(psoc, &ev);
+	status = rx_ops->process_stats_event(psoc, ev);
 
 end:
-	target_if_cp_stats_free_stats_event(&ev);
+	target_if_cp_stats_free_stats_event(ev);
+	qdf_mem_free(ev);
 
 	return qdf_status_to_os_return(status);
 }