qcacld-3.0: Use memory passed by caller in u_mac_post_ctrl_msg

Caller pass an allocated memory to u_mac_post_ctrl_msg, but memory
is again allocated in u_mac_post_ctrl_msg before passing it to message
queue.

This change remove this duplicate mem allocation and use the memory
passed by the caller.

Change-Id: I4d329c5883832bb6571d1e81f0d9b9a044ebb6d9
CRs-Fixed: 2050449
This commit is contained in:
Abhishek Singh 2017-05-22 15:25:39 +05:30 • committed by snandini
commit de410b77d3
2 changed files with 13 additions and 20 deletions

View file

@ -1284,7 +1284,7 @@ static void sme_process_ready_to_ext_wow(tHalHandle hHal,
--------------------------------------------------------------------------*/
QDF_STATUS sme_hdd_ready_ind(tHalHandle hHal)
{
tSirSmeReadyReq Msg;
tSirSmeReadyReq *msg;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
@ -1292,13 +1292,17 @@ QDF_STATUS sme_hdd_ready_ind(tHalHandle hHal)
TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
do {
Msg.messageType = eWNI_SME_SYS_READY_IND;
Msg.length = sizeof(tSirSmeReadyReq);
Msg.add_bssdescr_cb = csr_scan_process_single_bssdescr;
Msg.csr_roam_synch_cb = csr_roam_synch_callback;
msg = qdf_mem_malloc(sizeof(*msg));
if (!msg) {
sme_err("Memory allocation failed! for msg");
return QDF_STATUS_E_NOMEM;
}
msg->messageType = eWNI_SME_SYS_READY_IND;
msg->length = sizeof(*msg);
msg->add_bssdescr_cb = csr_scan_process_single_bssdescr;
msg->csr_roam_synch_cb = csr_roam_synch_callback;
if (eSIR_FAILURE != u_mac_post_ctrl_msg(hHal, (tSirMbMsg *) &Msg)) {
if (eSIR_FAILURE != u_mac_post_ctrl_msg(hHal, (tSirMbMsg *) msg)) {
status = QDF_STATUS_SUCCESS;
} else {
sme_err("u_mac_post_ctrl_msg failed to send eWNI_SME_SYS_READY_IND");

View file

@ -111,20 +111,10 @@ tSirRetStatus u_mac_post_ctrl_msg(void *pSirGlobal, tSirMbMsg *pMb)
struct scheduler_msg msg = {0};
tSirRetStatus status = eSIR_SUCCESS;
tpAniSirGlobal pMac = (tpAniSirGlobal) pSirGlobal;
tSirMbMsg *pMbLocal;
msg.type = pMb->type;
msg.bodyval = 0;
pMbLocal = qdf_mem_malloc(pMb->msgLen);
if (!pMbLocal) {
WMA_LOGE("Memory allocation failed! Can't send 0x%x\n",
msg.type);
return eSIR_MEM_ALLOC_FAILED;
}
qdf_mem_copy((void *)pMbLocal, (void *)pMb, pMb->msgLen);
msg.bodyptr = pMbLocal;
msg.bodyptr = pMb;
switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK) {
case WMA_MSG_TYPES_BEGIN: /* Posts a message to the HAL MsgQ */
@ -176,13 +166,12 @@ QDF_STATUS umac_send_mb_message_to_mac(void *pBuf)
if (NULL == hHal) {
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
"%s: invalid hHal", __func__);
qdf_mem_free(pBuf);
} else {
sirStatus = u_mac_post_ctrl_msg(hHal, pBuf);
if (eSIR_SUCCESS == sirStatus)
qdf_ret_status = QDF_STATUS_SUCCESS;
}
qdf_mem_free(pBuf);
return qdf_ret_status;
}