From f5b6c4135fbbc8052a0650ded1a8bdbe058a4199 Mon Sep 17 00:00:00 2001 From: Arif Hussain Date: Wed, 10 Oct 2018 19:41:09 -0700 Subject: [PATCH] qcacld-3.0: mac: Remove excessive logs Below API's logs failure with caller information, So no need logs at caller. qdf_mem_malloc_atomic() qdf_mem_malloc() wmi_buf_alloc() qdf_nbuf_alloc() wmi_unified_cmd_send() Change-Id: Ia1ec91d07ef014428921e7a88d8836266b378204 CRs-Fixed: 2331224 --- core/mac/src/cfg/cfg_api.c | 10 +- core/mac/src/cfg/cfg_send_msg.c | 7 +- core/mac/src/pe/lim/lim_admit_control.c | 8 +- core/mac/src/pe/lim/lim_api.c | 24 +--- core/mac/src/pe/lim/lim_assoc_utils.c | 38 ++---- core/mac/src/pe/lim/lim_ft.c | 20 +-- core/mac/src/pe/lim/lim_ft_preauth.c | 10 +- core/mac/src/pe/lim/lim_ibss_peer_mgmt.c | 17 +-- .../mac/src/pe/lim/lim_process_action_frame.c | 46 ++----- .../src/pe/lim/lim_process_assoc_req_frame.c | 12 +- .../src/pe/lim/lim_process_assoc_rsp_frame.c | 24 +--- core/mac/src/pe/lim/lim_process_auth_frame.c | 17 +-- .../mac/src/pe/lim/lim_process_beacon_frame.c | 11 +- core/mac/src/pe/lim/lim_process_fils.c | 47 ++----- .../src/pe/lim/lim_process_message_queue.c | 66 +++------- .../src/pe/lim/lim_process_mlm_host_roam.c | 11 +- .../src/pe/lim/lim_process_mlm_req_messages.c | 23 +--- .../src/pe/lim/lim_process_probe_req_frame.c | 9 +- .../src/pe/lim/lim_process_sme_req_messages.c | 123 +++++------------- core/mac/src/pe/lim/lim_process_tdls.c | 14 +- core/mac/src/pe/lim/lim_prop_exts_utils.c | 4 +- core/mac/src/pe/lim/lim_reassoc_utils.c | 6 +- core/mac/src/pe/lim/lim_security_utils.c | 8 +- .../src/pe/lim/lim_send_frames_host_roam.c | 19 +-- .../src/pe/lim/lim_send_management_frames.c | 27 +--- core/mac/src/pe/lim/lim_send_messages.c | 61 +++------ .../src/pe/lim/lim_send_sme_rsp_messages.c | 110 ++++------------ core/mac/src/pe/lim/lim_session.c | 23 +--- core/mac/src/pe/lim/lim_timer_utils.c | 5 +- core/mac/src/pe/lim/lim_utils.c | 52 ++------ core/mac/src/pe/nan/nan_datapath.c | 5 +- core/mac/src/pe/rrm/rrm_api.c | 45 ++----- core/mac/src/pe/sch/sch_beacon_gen.c | 11 +- core/mac/src/pe/sch/sch_beacon_process.c | 4 +- .../src/sys/legacy/src/utils/src/parser_api.c | 31 ++--- 35 files changed, 251 insertions(+), 697 deletions(-) diff --git a/core/mac/src/cfg/cfg_api.c b/core/mac/src/cfg/cfg_api.c index 8d161ec20c43..6ba00e2932b0 100644 --- a/core/mac/src/cfg/cfg_api.c +++ b/core/mac/src/cfg/cfg_api.c @@ -138,10 +138,9 @@ QDF_STATUS cfg_init(tpAniSirGlobal pMac) } /* at this point pMac->cfg.gCfgSBuf starts */ pMac->cfg.gCfgSBuf = qdf_mem_malloc(combined_buff_size); - if (NULL == pMac->cfg.gCfgSBuf) { - pe_err("Failed to allocate memory for cfg array"); + if (!pMac->cfg.gCfgSBuf) return QDF_STATUS_E_NOMEM; - } + /* at offset max_s_count, pMac->cfg.gCfgIBuf starts */ pMac->cfg.gCfgIBuf = (uint32_t *)&pMac->cfg.gCfgSBuf[max_s_count]; /* after max_i_count integers, pMac->cfg.gCfgIBufMin starts */ @@ -578,10 +577,9 @@ cfg_get_dot11d_transmit_power(tpAniSirGlobal pMac, uint16_t cfgId, } pCountryInfo = qdf_mem_malloc(cfgLength); - if (NULL == pCountryInfo) { - pe_err(" failed to allocate memory"); + if (!pCountryInfo) goto error; - } + /* The CSR will always update this CFG. The contents will be from country IE if regulatory domain * is enabled on AP else will contain EEPROM contents */ diff --git a/core/mac/src/cfg/cfg_send_msg.c b/core/mac/src/cfg/cfg_send_msg.c index 2536633ffeb7..cd953994fc24 100644 --- a/core/mac/src/cfg/cfg_send_msg.c +++ b/core/mac/src/cfg/cfg_send_msg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012, 2014-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -76,10 +76,9 @@ cfg_send_host_msg(tpAniSirGlobal pMac, uint16_t msgType, uint32_t msgLen, return; } pMsg = qdf_mem_malloc(msgLen); - if (NULL == pMsg) { - pe_err("Memory allocation failure!"); + if (!pMsg) return; - } + /* Fill in message details */ mmhMsg.type = msgType; mmhMsg.bodyptr = pMsg; diff --git a/core/mac/src/pe/lim/lim_admit_control.c b/core/mac/src/pe/lim/lim_admit_control.c index 1b90a9bce523..e5d0fc91fc7d 100644 --- a/core/mac/src/pe/lim/lim_admit_control.c +++ b/core/mac/src/pe/lim/lim_admit_control.c @@ -853,10 +853,8 @@ lim_send_hal_msg_add_ts(tpAniSirGlobal pMac, } pAddTsParam = qdf_mem_malloc(sizeof(tAddTsParams)); - if (NULL == pAddTsParam) { - pe_err("AllocateMemory() failed"); + if (!pAddTsParam) return QDF_STATUS_E_NOMEM; - } pAddTsParam->staIdx = staIdx; pAddTsParam->tspecIdx = tspecIdx; @@ -913,10 +911,8 @@ lim_send_hal_msg_del_ts(tpAniSirGlobal pMac, tpPESession psessionEntry = NULL; pDelTsParam = qdf_mem_malloc(sizeof(tDelTsParams)); - if (NULL == pDelTsParam) { - pe_err("AllocateMemory() failed"); + if (!pDelTsParam) return QDF_STATUS_E_NOMEM; - } msg.type = WMA_DEL_TS_REQ; msg.bodyptr = pDelTsParam; diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index 87adb146615b..d98135474e78 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -860,16 +860,14 @@ QDF_STATUS pe_open(tpAniSirGlobal pMac, struct cds_config_info *cds_cfg) pMac->lim.limTimers.gpLimCnfWaitTimer = qdf_mem_malloc(sizeof(TX_TIMER) * (pMac->lim.maxStation + 1)); - if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer) { - pe_err("gpLimCnfWaitTimer memory allocate failed!"); + if (!pMac->lim.limTimers.gpLimCnfWaitTimer) { status = QDF_STATUS_E_NOMEM; goto pe_open_timer_fail; } pMac->lim.gpSession = qdf_mem_malloc(sizeof(tPESession) * pMac->lim.maxBssId); - if (NULL == pMac->lim.gpSession) { - pe_err("gpSession memory allocate failed!"); + if (!pMac->lim.gpSession) { status = QDF_STATUS_E_NOMEM; goto pe_open_psession_fail; } @@ -1307,7 +1305,6 @@ static QDF_STATUS pe_handle_mgmt_frame(struct wlan_objmgr_psoc *psoc, pVosPkt = qdf_mem_malloc(sizeof(*pVosPkt)); if (!pVosPkt) { - pe_err("Failed to allocate rx packet"); qdf_nbuf_free(buf); return QDF_STATUS_E_NOMEM; } @@ -2072,12 +2069,9 @@ lim_roam_fill_bss_descr(tpAniSirGlobal pMac, bcn_proberesp_ptr = (uint8_t *)roam_offload_synch_ind_ptr + roam_offload_synch_ind_ptr->beaconProbeRespOffset; mac_hdr = (tpSirMacMgmtHdr)bcn_proberesp_ptr; - parsed_frm_ptr = - (tpSirProbeRespBeacon) qdf_mem_malloc(sizeof(tSirProbeRespBeacon)); - if (NULL == parsed_frm_ptr) { - pe_err("fail to allocate memory for frame"); + parsed_frm_ptr = qdf_mem_malloc(sizeof(tSirProbeRespBeacon)); + if (!parsed_frm_ptr) return QDF_STATUS_E_NOMEM; - } if (roam_offload_synch_ind_ptr->beaconProbeRespLength <= SIR_MAC_HDR_LEN_3A) { @@ -2411,8 +2405,7 @@ QDF_STATUS pe_roam_synch_callback(tpAniSirGlobal mac_ctx, mac_ctx->roam.reassocRespLen = roam_sync_ind_ptr->reassocRespLength; mac_ctx->roam.pReassocResp = qdf_mem_malloc(mac_ctx->roam.reassocRespLen); - if (NULL == mac_ctx->roam.pReassocResp) { - pe_err("LFR3:assoc resp mem alloc failed"); + if (!mac_ctx->roam.pReassocResp) { ft_session_ptr->bRoamSynchInProgress = false; return QDF_STATUS_E_NOMEM; } @@ -2449,8 +2442,7 @@ QDF_STATUS pe_roam_synch_callback(tpAniSirGlobal mac_ctx, #endif roam_sync_ind_ptr->join_rsp = qdf_mem_malloc(join_rsp_len); - if (NULL == roam_sync_ind_ptr->join_rsp) { - pe_err("LFR3:mem alloc failed"); + if (!roam_sync_ind_ptr->join_rsp) { ft_session_ptr->bRoamSynchInProgress = false; if (mac_ctx->roam.pReassocResp) qdf_mem_free(mac_ctx->roam.pReassocResp); @@ -2680,10 +2672,8 @@ void lim_update_lost_link_info(tpAniSirGlobal mac, tpPESession session, return; lost_link_info = qdf_mem_malloc(sizeof(*lost_link_info)); - if (NULL == lost_link_info) { - pe_err("lost_link_info allocation failure"); + if (!lost_link_info) return; - } lost_link_info->vdev_id = session->smeSessionId; lost_link_info->rssi = rssi; diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index a3aac4391b3d..ee5aec1394af 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -188,10 +188,8 @@ lim_check_rx_basic_rates(tpAniSirGlobal pMac, tSirMacRateSet rxRateSet, uint8_t i, j, k, match; pRateSet = qdf_mem_malloc(sizeof(tSirMacRateSet)); - if (NULL == pRateSet) { - pe_err("call to AllocateMemory failed for RATESET"); + if (!pRateSet) return false; - } /* Copy operational rate set from session Entry */ qdf_mem_copy(pRateSet->rate, (psessionEntry->rateSet.rate), @@ -2125,10 +2123,8 @@ lim_add_sta(tpAniSirGlobal mac_ctx, GET_LIM_SYSTEM_ROLE(session_entry)); add_sta_params = qdf_mem_malloc(sizeof(tAddStaParams)); - if (NULL == add_sta_params) { - pe_err("Unable to allocate memory during ADD_STA"); + if (!add_sta_params) return QDF_STATUS_E_NOMEM; - } if (LIM_IS_AP_ROLE(session_entry) || LIM_IS_IBSS_ROLE(session_entry) || LIM_IS_NDI_ROLE(session_entry)) @@ -2571,10 +2567,8 @@ lim_del_sta(tpAniSirGlobal pMac, QDF_STATUS retCode = QDF_STATUS_SUCCESS; pDelStaParams = qdf_mem_malloc(sizeof(tDeleteStaParams)); - if (NULL == pDelStaParams) { - pe_err("Unable to allocate memory during ADD_STA"); + if (!pDelStaParams) return QDF_STATUS_E_NOMEM; - } /* * 2G-AS platform: SAP associates with HT (11n)clients as 2x1 in 2G and @@ -2739,10 +2733,8 @@ lim_add_sta_self(tpAniSirGlobal pMac, uint16_t staIdx, uint8_t updateSta, sir_copy_mac_addr(staMac, psessionEntry->selfMacAddr); pe_debug(MAC_ADDRESS_STR ": ", MAC_ADDR_ARRAY(staMac)); pAddStaParams = qdf_mem_malloc(sizeof(tAddStaParams)); - if (NULL == pAddStaParams) { - pe_err("Unable to allocate memory during ADD_STA"); + if (!pAddStaParams) return QDF_STATUS_E_NOMEM; - } /* / Add STA context at MAC HW (BMU, RHP & TFP) */ qdf_mem_copy((uint8_t *) pAddStaParams->staMac, @@ -3379,10 +3371,8 @@ lim_del_bss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, uint16_t bssIdx, QDF_STATUS retCode = QDF_STATUS_SUCCESS; pDelBssParams = qdf_mem_malloc(sizeof(tDeleteBssParams)); - if (NULL == pDelBssParams) { - pe_err("Unable to allocate memory during ADD_BSS"); + if (!pDelBssParams) return QDF_STATUS_E_NOMEM; - } pDelBssParams->sessionId = psessionEntry->peSessionId; /* update PE session Id */ @@ -3596,8 +3586,7 @@ QDF_STATUS lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, /* Package SIR_HAL_ADD_BSS_REQ message parameters */ pAddBssParams = qdf_mem_malloc(sizeof(tAddBssParams)); - if (NULL == pAddBssParams) { - pe_err("Unable to allocate memory during ADD_BSS"); + if (!pAddBssParams) { retCode = QDF_STATUS_E_NOMEM; goto returnFailure; } @@ -4133,15 +4122,12 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(tpAniSirGlobal pMac, uint8_t updateEnt &psessionEntry->pLimJoinReq->bssDescription; pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); - if (NULL == pBeaconStruct) { - pe_err("Unable to allocate memory during ADD_BSS"); + if (!pBeaconStruct) return QDF_STATUS_E_NOMEM; - } /* Package SIR_HAL_ADD_BSS_REQ message parameters */ pAddBssParams = qdf_mem_malloc(sizeof(tAddBssParams)); - if (NULL == pAddBssParams) { - pe_err("Unable to allocate memory during ADD_BSS"); + if (!pAddBssParams) { retCode = QDF_STATUS_E_NOMEM; goto returnFailure; } @@ -4824,10 +4810,8 @@ void lim_send_sme_unprotected_mgmt_frame_ind(tpAniSirGlobal pMac, uint8_t frameT length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen; pSirSmeMgmtFrame = qdf_mem_malloc(length); - if (NULL == pSirSmeMgmtFrame) { - pe_err("Memory allocation failed"); + if (!pSirSmeMgmtFrame) return; - } pSirSmeMgmtFrame->sessionId = sessionId; pSirSmeMgmtFrame->frameType = frameType; @@ -4865,10 +4849,8 @@ void lim_send_sme_tsm_ie_ind(tpAniSirGlobal pMac, tpPESession psessionEntry, return; pSirSmeTsmIeInd = qdf_mem_malloc(sizeof(tSirSmeTsmIEInd)); - if (NULL == pSirSmeTsmIeInd) { - pe_err("AllocateMemory failed for tSirSmeTsmIEInd"); + if (!pSirSmeTsmIeInd) return; - } pSirSmeTsmIeInd->sessionId = psessionEntry->smeSessionId; pSirSmeTsmIeInd->tsmIe.tsid = tid; diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index 622607cb4caa..72ad125724d1 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -134,15 +134,13 @@ void lim_ft_prepare_add_bss_req(tpAniSirGlobal pMac, } pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); - if (NULL == pBeaconStruct) { - pe_err("Unable to allocate memory for creating ADD_BSS"); + if (!pBeaconStruct) return; - } + /* Package SIR_HAL_ADD_BSS_REQ message parameters */ pAddBssParams = qdf_mem_malloc(sizeof(tAddBssParams)); - if (NULL == pAddBssParams) { + if (!pAddBssParams) { qdf_mem_free(pBeaconStruct); - pe_err("Unable to allocate memory for creating ADD_BSS"); return; } @@ -533,9 +531,8 @@ void lim_fill_ft_session(tpAniSirGlobal pMac, ePhyChanBondState cbEnabledMode; pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); - if (NULL == pBeaconStruct) { + if (!pBeaconStruct) return; - } /* Retrieve the session that was already created and update the entry */ pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled; @@ -837,10 +834,9 @@ lim_ft_send_aggr_qos_rsp(tpAniSirGlobal pMac, uint8_t rspReqd, return; } rsp = qdf_mem_malloc(sizeof(tSirAggrQosRsp)); - if (NULL == rsp) { - pe_err("AllocateMemory failed for tSirAggrQosRsp"); + if (!rsp) return; - } + rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP; rsp->sessionId = smesessionId; rsp->length = sizeof(*rsp); @@ -938,10 +934,8 @@ QDF_STATUS lim_process_ft_aggr_qos_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf) int i; pAggrAddTsParam = qdf_mem_malloc(sizeof(tAggrAddTsParams)); - if (NULL == pAggrAddTsParam) { - pe_err("AllocateMemory() failed"); + if (!pAggrAddTsParam) return QDF_STATUS_E_NOMEM; - } psessionEntry = pe_find_session_by_bssid(pMac, aggrQosReq->bssid.bytes, &sessionId); diff --git a/core/mac/src/pe/lim/lim_ft_preauth.c b/core/mac/src/pe/lim/lim_ft_preauth.c index 7e6565e9c208..4fdabb299b6d 100644 --- a/core/mac/src/pe/lim/lim_ft_preauth.c +++ b/core/mac/src/pe/lim/lim_ft_preauth.c @@ -597,9 +597,8 @@ void lim_post_ft_pre_auth_rsp(tpAniSirGlobal mac_ctx, struct scheduler_msg mmh_msg = {0}; uint16_t rsp_len = sizeof(tSirFTPreAuthRsp); - ft_pre_auth_rsp = (tpSirFTPreAuthRsp) qdf_mem_malloc(rsp_len); - if (NULL == ft_pre_auth_rsp) { - pe_err("Failed to allocate memory"); + ft_pre_auth_rsp = qdf_mem_malloc(rsp_len); + if (!ft_pre_auth_rsp) { QDF_ASSERT(ft_pre_auth_rsp != NULL); return; } @@ -685,11 +684,8 @@ QDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx, session_id = session_entry->smeSessionId; req = qdf_mem_malloc(sizeof(*req)); - if (!req) { - QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, - FL("Failed to allocate memory")); + if (!req) return QDF_STATUS_E_NOMEM; - } qdf_mem_zero(req, sizeof(*req)); diff --git a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c index e9e1618d70f0..b2e60171a79f 100644 --- a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c +++ b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c @@ -378,13 +378,11 @@ ibss_coalesce_save(tpAniSirGlobal pMac, ibss_coalesce_free(pMac); pMac->lim.ibssInfo.pHdr = qdf_mem_malloc(sizeof(*pHdr)); - if (NULL == pMac->lim.ibssInfo.pHdr) { - pe_err("ibbs-save: Failed malloc pHdr"); + if (!pMac->lim.ibssInfo.pHdr) return; - } + pMac->lim.ibssInfo.pBeacon = qdf_mem_malloc(sizeof(*pBeacon)); - if (NULL == pMac->lim.ibssInfo.pBeacon) { - pe_err("ibbs-save: Failed malloc pBeacon"); + if (!pMac->lim.ibssInfo.pBeacon) { ibss_coalesce_free(pMac); return; } @@ -1494,11 +1492,8 @@ lim_ibss_coalesce(tpAniSirGlobal pMac, sizeof(tLimIbssPeerNode) + ieLen - sizeof(uint32_t); pPeerNode = qdf_mem_malloc((uint16_t) frameLen); - if (NULL == pPeerNode) { - pe_err("alloc fail %d bytes storing IBSS peer info", - frameLen); + if (!pPeerNode) return QDF_STATUS_E_NOMEM; - } pPeerNode->beacon = NULL; pPeerNode->beaconLen = 0; @@ -1506,9 +1501,7 @@ lim_ibss_coalesce(tpAniSirGlobal pMac, ibss_peer_collect(pMac, pBeacon, pHdr, pPeerNode, psessionEntry); pPeerNode->beacon = qdf_mem_malloc(ieLen); - if (NULL == pPeerNode->beacon) { - pe_err("Unable to allocate memory to store beacon"); - } else { + if (pPeerNode->beacon) { qdf_mem_copy(pPeerNode->beacon, pIEs, ieLen); pPeerNode->beaconLen = (uint16_t) ieLen; } diff --git a/core/mac/src/pe/lim/lim_process_action_frame.c b/core/mac/src/pe/lim/lim_process_action_frame.c index a1739c714cfa..4291203222c0 100644 --- a/core/mac/src/pe/lim/lim_process_action_frame.c +++ b/core/mac/src/pe/lim/lim_process_action_frame.c @@ -227,10 +227,8 @@ static void __lim_process_channel_switch_action_frame(tpAniSirGlobal mac_ctx, return; chnl_switch_frame = qdf_mem_malloc(sizeof(*chnl_switch_frame)); - if (NULL == chnl_switch_frame) { - pe_err("AllocateMemory failed"); + if (!chnl_switch_frame) return; - } /* Unpack channel switch frame */ status = dot11f_unpack_channel_switch(mac_ctx, body_ptr, frame_len, @@ -361,10 +359,8 @@ lim_process_ext_channel_switch_action_frame(tpAniSirGlobal mac_ctx, ext_channel_switch_frame = qdf_mem_malloc(sizeof(*ext_channel_switch_frame)); - if (NULL == ext_channel_switch_frame) { - pe_err("AllocateMemory failed"); + if (!ext_channel_switch_frame) return; - } /* Unpack channel switch frame */ status = dot11f_unpack_ext_channel_switch_action_frame(mac_ctx, @@ -408,10 +404,8 @@ lim_process_ext_channel_switch_action_frame(tpAniSirGlobal mac_ctx, struct scheduler_msg mmh_msg = {0}; ext_cng_chan_ind = qdf_mem_malloc(sizeof(*ext_cng_chan_ind)); - if (NULL == ext_cng_chan_ind) { - pe_err("AllocateMemory failed for ext_cng_chan_ind"); + if (!ext_cng_chan_ind) return; - } ext_cng_chan_ind->session_id = session_entry->smeSessionId; @@ -461,10 +455,9 @@ static void __lim_process_operating_mode_action_frame(tpAniSirGlobal mac_ctx, pe_debug("Received Operating Mode action frame"); operating_mode_frm = qdf_mem_malloc(sizeof(*operating_mode_frm)); - if (NULL == operating_mode_frm) { - pe_err("AllocateMemory failed"); + if (!operating_mode_frm) return; - } + /* Unpack channel switch frame */ status = dot11f_unpack_operating_mode(mac_ctx, body_ptr, frame_len, operating_mode_frm, false); @@ -603,10 +596,8 @@ static void __lim_process_gid_management_action_frame(tpAniSirGlobal mac_ctx, pe_debug("Received GID Management action frame"); gid_mgmt_frame = qdf_mem_malloc(sizeof(*gid_mgmt_frame)); - if (NULL == gid_mgmt_frame) { - pe_err("AllocateMemory failed"); + if (!gid_mgmt_frame) return; - } /* Unpack Gid Management Action frame */ status = dot11f_unpack_vht_gid_management_action_frame(mac_ctx, @@ -1149,10 +1140,8 @@ __lim_process_measurement_request_frame(tpAniSirGlobal pMac, frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); pMeasReqFrame = qdf_mem_malloc(sizeof(tSirMacMeasReqActionFrame)); - if (NULL == pMeasReqFrame) { - pe_err("AllocateMemory failed"); + if (!pMeasReqFrame) return; - } if (sir_convert_meas_req_frame2_struct(pMac, pBody, pMeasReqFrame, frameLen) != QDF_STATUS_SUCCESS) { @@ -1193,10 +1182,9 @@ __lim_process_tpc_request_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, pe_debug("****LIM: Processing TPC Request from peer ****"); pTpcReqFrame = qdf_mem_malloc(sizeof(tSirMacTpcReqActionFrame)); - if (NULL == pTpcReqFrame) { - pe_err("AllocateMemory failed"); + if (!pTpcReqFrame) return; - } + if (sir_convert_tpc_req_frame2_struct(pMac, pBody, pTpcReqFrame, frameLen) != QDF_STATUS_SUCCESS) { pe_warn("Rcv invalid TPC Req Action Frame"); @@ -1318,10 +1306,8 @@ __lim_process_radio_measure_request(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, WMA_GET_RX_RSSI_NORMALIZED(pRxPacketInfo)); frm = qdf_mem_malloc(sizeof(*frm)); - if (frm == NULL) { - pe_err("Failed to alloc memory for tDot11fRadioMeasurementRequest"); + if (!frm) return; - } /**Unpack the received frame */ nStatus = dot11f_unpack_radio_measurement_request(pMac, pBody, @@ -1398,10 +1384,8 @@ __lim_process_neighbor_report(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); pFrm = qdf_mem_malloc(sizeof(tDot11fNeighborReportResponse)); - if (NULL == pFrm) { - pe_err("Unable to allocate memory"); + if (!pFrm) return; - } if (psessionEntry == NULL) { qdf_mem_free(pFrm); @@ -1678,10 +1662,8 @@ static void lim_process_addba_req(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, body_ptr, frame_len); addba_req = qdf_mem_malloc(sizeof(*addba_req)); - if (NULL == addba_req) { - pe_err("memory allocation failed"); + if (!addba_req) return; - } /* Unpack ADDBA request frame */ status = dot11f_unpack_addba_req(mac_ctx, body_ptr, frame_len, @@ -1762,10 +1744,8 @@ static void lim_process_delba_req(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, body_ptr, frame_len); delba_req = qdf_mem_malloc(sizeof(*delba_req)); - if (NULL == delba_req) { - pe_err("memory allocation failed"); + if (!delba_req) return; - } /* Unpack DELBA request frame */ status = dot11f_unpack_delba_req(mac_ctx, body_ptr, frame_len, diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index 030bc933c510..c33d293642d4 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -1935,10 +1935,8 @@ void lim_process_assoc_req_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, } /* Allocate memory for the Assoc Request frame */ assoc_req = qdf_mem_malloc(sizeof(*assoc_req)); - if (NULL == assoc_req) { - pe_err("Allocate Memory failed in assoc_req"); + if (!assoc_req) return; - } /* Parse Assoc Request frame */ if (false == lim_chk_assoc_req_parse_error(mac_ctx, hdr, session, @@ -1946,11 +1944,8 @@ void lim_process_assoc_req_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, goto error; assoc_req->assocReqFrame = qdf_mem_malloc(frame_len); - if (NULL == assoc_req->assocReqFrame) { - pe_err("Memory alloc failed for the assoc req, len: %d", - frame_len); + if (!assoc_req->assocReqFrame) goto error; - } qdf_mem_copy((uint8_t *) assoc_req->assocReqFrame, (uint8_t *) frm_body, frame_len); @@ -2327,10 +2322,9 @@ void lim_send_mlm_assoc_ind(tpAniSirGlobal mac_ctx, temp = sizeof(tLimMlmAssocInd); assoc_ind = qdf_mem_malloc(temp); - if (NULL == assoc_ind) { + if (!assoc_ind) { lim_release_peer_idx(mac_ctx, sta_ds->assocId, session_entry); - pe_err("AllocateMemory failed for assoc_ind"); return; } qdf_mem_copy((uint8_t *) assoc_ind->peerMacAddr, diff --git a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c index 6b20d7a48a33..13e0949a2675 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c @@ -304,14 +304,12 @@ static void lim_update_ric_data(tpAniSirGlobal mac_ctx, if (session_entry->RICDataLen) { session_entry->ricData = qdf_mem_malloc(session_entry->RICDataLen); - if (NULL == session_entry->ricData) { - pe_err("No memory for RIC data"); + if (!session_entry->ricData) session_entry->RICDataLen = 0; - } else { + else qdf_mem_copy(session_entry->ricData, &assoc_rsp->RICData[0], session_entry->RICDataLen); - } } else { pe_err("RIC data not present"); } @@ -350,14 +348,12 @@ static void lim_update_ese_tspec(tpAniSirGlobal mac_ctx, if (session_entry->tspecLen) { session_entry->tspecIes = qdf_mem_malloc(session_entry->tspecLen); - if (NULL == session_entry->tspecIes) { - pe_err("Tspec IE:Fail to allocate memory"); + if (!session_entry->tspecIes) session_entry->tspecLen = 0; - } else { + else qdf_mem_copy(session_entry->tspecIes, &assoc_rsp->TSPECInfo[0], session_entry->tspecLen); - } } else { pe_err("TSPEC has Zero length"); } @@ -535,10 +531,8 @@ lim_process_assoc_rsp_frame(tpAniSirGlobal mac_ctx, MAC_ADDR_ARRAY(hdr->sa)); beacon = qdf_mem_malloc(sizeof(tSchBeaconStruct)); - if (NULL == beacon) { - pe_err("Unable to allocate memory"); + if (!beacon) return; - } if (LIM_IS_AP_ROLE(session_entry)) { /* @@ -611,8 +605,7 @@ lim_process_assoc_rsp_frame(tpAniSirGlobal mac_ctx, } assoc_rsp = qdf_mem_malloc(sizeof(*assoc_rsp)); - if (NULL == assoc_rsp) { - pe_err("Allocate Memory failed in AssocRsp"); + if (!assoc_rsp) { qdf_mem_free(beacon); return; } @@ -648,10 +641,7 @@ lim_process_assoc_rsp_frame(tpAniSirGlobal mac_ctx, if (frame_len) { session_entry->assocRsp = qdf_mem_malloc(frame_len); - if (NULL == session_entry->assocRsp) { - pe_err("Unable to allocate memory for assoc res,len: %d", - frame_len); - } else { + if (session_entry->assocRsp) { /* * Store the Assoc response. This is sent * to csr/hdd in join cnf response. diff --git a/core/mac/src/pe/lim/lim_process_auth_frame.c b/core/mac/src/pe/lim/lim_process_auth_frame.c index 10b98226885a..8b95d6daf422 100644 --- a/core/mac/src/pe/lim/lim_process_auth_frame.c +++ b/core/mac/src/pe/lim/lim_process_auth_frame.c @@ -797,10 +797,8 @@ static void lim_process_auth_frame_type2(tpAniSirGlobal mac_ctx, rx_auth_frm_body->length); encr_auth_frame = qdf_mem_malloc(rx_auth_frm_body->length + LIM_ENCR_AUTH_INFO_LEN); - if (!encr_auth_frame) { - pe_err("failed to allocate memory"); + if (!encr_auth_frame) return; - } lim_encrypt_auth_frame(mac_ctx, key_id, defaultkey, plainbody, encr_auth_frame, key_length); @@ -1191,22 +1189,17 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, } rx_auth_frame = qdf_mem_malloc(sizeof(tSirMacAuthFrameBody)); - if (!rx_auth_frame) { - pe_err("failed to allocate memory"); + if (!rx_auth_frame) return; - } auth_frame = qdf_mem_malloc(sizeof(tSirMacAuthFrameBody)); - if (!auth_frame) { - pe_err("failed to allocate memory"); + if (!auth_frame) goto free; - } plainbody = qdf_mem_malloc(LIM_ENCR_AUTH_BODY_LEN); - if (!plainbody) { - pe_err("failed to allocate memory for plainbody"); + if (!plainbody) goto free; - } + qdf_mem_zero(plainbody, LIM_ENCR_AUTH_BODY_LEN); /* diff --git a/core/mac/src/pe/lim/lim_process_beacon_frame.c b/core/mac/src/pe/lim/lim_process_beacon_frame.c index e049275eee64..db3f957d3009 100644 --- a/core/mac/src/pe/lim/lim_process_beacon_frame.c +++ b/core/mac/src/pe/lim/lim_process_beacon_frame.c @@ -74,10 +74,9 @@ lim_process_beacon_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, /* Expect Beacon in any state as Scan is independent of LIM state */ bcn_ptr = qdf_mem_malloc(sizeof(*bcn_ptr)); - if (NULL == bcn_ptr) { - pe_err("Unable to allocate memory"); + if (!bcn_ptr) return; - } + /* Parse received Beacon */ if (sir_convert_beacon_frame2_struct(mac_ctx, rx_pkt_info, bcn_ptr) != @@ -131,9 +130,7 @@ lim_process_beacon_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, } session->bcnLen = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); session->beacon = qdf_mem_malloc(session->bcnLen); - if (NULL == session->beacon) { - pe_err("fail to alloc mem to store bcn"); - } else { + if (session->beacon) /* * Store the Beacon/ProbeRsp. This is sent to * csr/hdd in join cnf response. @@ -141,7 +138,7 @@ lim_process_beacon_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, qdf_mem_copy(session->beacon, WMA_GET_RX_MPDU_DATA(rx_pkt_info), session->bcnLen); - } + lim_check_and_announce_join_success(mac_ctx, bcn_ptr, mac_hdr, session); } diff --git a/core/mac/src/pe/lim/lim_process_fils.c b/core/mac/src/pe/lim/lim_process_fils.c index d6903626cc2c..26a78b4f3ab5 100644 --- a/core/mac/src/pe/lim/lim_process_fils.c +++ b/core/mac/src/pe/lim/lim_process_fils.c @@ -355,10 +355,9 @@ static uint32_t lim_process_fils_eap_tlv(tpPESession pe_session, switch (tlv->type) { case SIR_FILS_EAP_TLV_KEYNAME_NAI: auth_info->keyname = qdf_mem_malloc(tlv->length); - if (!auth_info->keyname) { - pe_err("failed to alloc memory"); + if (!auth_info->keyname) return 0; - } + qdf_mem_copy(auth_info->keyname, tlv->data, tlv->length); auth_info->keylength = tlv->length; @@ -379,10 +378,9 @@ static uint32_t lim_process_fils_eap_tlv(tpPESession pe_session, break; case SIR_FILS_EAP_TLV_DOMAIN_NAME: auth_info->domain_name = qdf_mem_malloc(tlv->length); - if (!auth_info->domain_name) { - pe_err("failed to alloc memory"); + if (!auth_info->domain_name) return 0; - } + qdf_mem_copy(auth_info->domain_name, tlv->data, tlv->length); auth_info->domain_len = tlv->length; @@ -552,10 +550,8 @@ static void lim_get_keys(tpPESession pe_session) data_len = 2 * SIR_FILS_NONCE_LENGTH + 2 * QDF_MAC_ADDR_SIZE; data = qdf_mem_malloc(data_len); - if (!data) { - pe_err("failed to alloc memory"); + if (!data) return; - } /* Update data */ buf = data; @@ -636,10 +632,8 @@ static void lim_generate_pmk(tpPESession pe_session) qdf_mem_free(fils_info->fils_pmk); fils_info->fils_pmk = qdf_mem_malloc(fils_info->fils_pmk_len); - if (!fils_info->fils_pmk) { - pe_err("failed to alloc memory"); + if (!fils_info->fils_pmk) return; - } addr[0] = fils_info->fils_rmsk; len[0] = fils_info->fils_rmsk_len; @@ -670,10 +664,8 @@ static void lim_generate_rmsk_data(tpPESession pe_session) auth_info = &(pe_session->fils_info->auth_info); fils_info->fils_rmsk_len = fils_info->fils_rrk_len; fils_info->fils_rmsk = qdf_mem_malloc(fils_info->fils_rrk_len); - if (!fils_info->fils_rmsk) { - pe_err("failed to alloc memory"); + if (!fils_info->fils_rmsk) return; - } /* * Sequence number sent in EAP-INIT packet, @@ -890,10 +882,9 @@ static int lim_create_fils_wrapper_data(struct pe_fils_session *fils_info) sizeof(uint8_t) + lim_get_auth_tag_len(HMAC_SHA256_128); fils_info->fils_erp_reauth_pkt = qdf_mem_malloc(buf_len); - if (!fils_info->fils_erp_reauth_pkt) { - pe_err("failed to allocate memory"); + if (!fils_info->fils_erp_reauth_pkt) return -EINVAL; - } + buf = fils_info->fils_erp_reauth_pkt; *buf = 5; buf++; @@ -944,7 +935,6 @@ static int lim_create_fils_wrapper_data(struct pe_fils_session *fils_info) if (!fils_info->fils_rik) { qdf_mem_free(fils_info->fils_erp_reauth_pkt); fils_info->fils_erp_reauth_pkt = NULL; - pe_err("failed to alloc memory"); return -EINVAL; } status = lim_create_fils_rik(fils_info->fils_rrk, @@ -1155,17 +1145,15 @@ void lim_update_fils_config(tpPESession session, } csr_fils_info->keyname_nai_data = qdf_mem_malloc(fils_config_info->key_nai_length); - if (!csr_fils_info->keyname_nai_data) { - pe_err("failed to alloc memory"); + if (!csr_fils_info->keyname_nai_data) return; - } + qdf_mem_copy(csr_fils_info->keyname_nai_data, fils_config_info->keyname_nai, fils_config_info->key_nai_length); csr_fils_info->fils_rrk = qdf_mem_malloc(fils_config_info->r_rk_length); if (!csr_fils_info->fils_rrk) { - pe_err("failed to alloc memory"); qdf_mem_free(csr_fils_info->keyname_nai_data); return; } @@ -1189,7 +1177,6 @@ void lim_update_fils_config(tpPESession session, if (!csr_fils_info->fils_pmk) { qdf_mem_free(csr_fils_info->keyname_nai_data); qdf_mem_free(csr_fils_info->fils_rrk); - pe_err("failed to alloc memory"); return; } qdf_mem_copy(csr_fils_info->fils_pmk, fils_config_info->pmk, @@ -1274,7 +1261,6 @@ void populate_fils_connect_params(tpAniSirGlobal mac_ctx, sme_join_rsp->fils_join_rsp = qdf_mem_malloc(sizeof(*fils_join_rsp)); if (!sme_join_rsp->fils_join_rsp) { - pe_err("fils_join_rsp malloc fails!"); pe_delete_fils_info(session); return; } @@ -1282,7 +1268,6 @@ void populate_fils_connect_params(tpAniSirGlobal mac_ctx, fils_join_rsp = sme_join_rsp->fils_join_rsp; fils_join_rsp->fils_pmk = qdf_mem_malloc(fils_info->fils_pmk_len); if (!fils_join_rsp->fils_pmk) { - pe_err("fils_pmk malloc fails!"); qdf_mem_free(fils_join_rsp); pe_delete_fils_info(session); return; @@ -1581,11 +1566,8 @@ static int fils_aead_encrypt(const u8 *kek, unsigned int kek_len, if (plain_text == out) { buf = qdf_mem_malloc(plain_text_len); - if (buf == NULL) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - FL("Failed to allocate memory")); + if (!buf) return -ENOMEM; - } qdf_mem_copy(buf, plain_text, plain_text_len); } else { buf = plain_text; @@ -1740,11 +1722,8 @@ static int fils_aead_decrypt(const u8 *kek, unsigned int kek_len, if (ciphered_text == plain_text) { /* in place decryption */ buf = qdf_mem_malloc(buf_len); - if (buf == NULL) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - FL("Failed to allocate memory")); + if (!buf) return -ENOMEM; - } qdf_mem_copy(buf, ciphered_text + AES_BLOCK_SIZE, buf_len); } else { buf = ciphered_text + AES_BLOCK_SIZE; diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index 53e70f23b918..942c0618d95b 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -159,13 +159,8 @@ static void lim_process_dual_mac_cfg_resp(tpAniSirGlobal mac, void *body) len = sizeof(*param); param = qdf_mem_malloc(len); - if (!param) { - pe_err("Fail to allocate memory"); - /* Memory allocation for param failed. - * Cannot send fail status back to SME - */ + if (!param) return; - } if (fail_resp) { pe_err("Send fail status to SME"); @@ -213,13 +208,8 @@ static void lim_process_set_hw_mode_resp(tpAniSirGlobal mac, void *body) len = sizeof(*param); param = qdf_mem_malloc(len); - if (!param) { - pe_err("Fail to allocate memory"); - /* Memory allocation for param failed. - * Cannot send fail status back to SME - */ + if (!param) return; - } if (fail_resp) { pe_err("Send fail status to SME"); @@ -279,13 +269,8 @@ static void lim_process_set_antenna_resp(tpAniSirGlobal mac, void *body) } param = qdf_mem_malloc(sizeof(*param)); - if (!param) { - pe_err("Fail to allocate memory"); - /* Memory allocation for param failed. - * Cannot send fail status back to SME - */ + if (!param) return; - } if (fail_resp) { pe_err("Send fail status to SME"); @@ -332,10 +317,8 @@ static void lim_process_set_default_scan_ie_request(tpAniSirGlobal mac_ctx, local_ie_len = set_ie_params->ie_len; local_ie_buf = qdf_mem_malloc(MAX_DEFAULT_SCAN_IE_LEN); - if (!local_ie_buf) { - pe_err("Scan IE Update fails due to malloc failure"); + if (!local_ie_buf) return; - } if (lim_update_ext_cap_ie(mac_ctx, (uint8_t *)set_ie_params->ie_data, @@ -345,10 +328,9 @@ static void lim_process_set_default_scan_ie_request(tpAniSirGlobal mac_ctx, } wma_ie_params = qdf_mem_malloc(sizeof(*wma_ie_params) + local_ie_len); - if (!wma_ie_params) { - pe_err("fail to alloc wma_ie_params"); + if (!wma_ie_params) goto scan_ie_send_fail; - } + wma_ie_params->vdev_id = set_ie_params->session_id; wma_ie_params->ie_id = DEFAULT_SCAN_IE_ID; wma_ie_params->length = local_ie_len; @@ -394,10 +376,8 @@ static void lim_process_hw_mode_trans_ind(tpAniSirGlobal mac, void *body) len = sizeof(*param); param = qdf_mem_malloc(len); - if (!param) { - pe_err("Fail to allocate memory"); + if (!param) return; - } param->old_hw_mode_index = ind->old_hw_mode_index; param->new_hw_mode_index = ind->new_hw_mode_index; @@ -535,10 +515,9 @@ __lim_pno_match_fwd_bcn_probepsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info, ie_len; result = qdf_mem_malloc(len); - if (NULL == result) { - pe_err("Memory allocation failed"); + if (!result) return; - } + hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); @@ -589,10 +568,9 @@ __lim_ext_scan_forward_bcn_probe_rsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info, tSirBssDescription *bssdescr; result = qdf_mem_malloc(sizeof(*result) + ie_len); - if (NULL == result) { - pe_err("Memory allocation failed"); + if (!result) return; - } + hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); @@ -621,12 +599,10 @@ __lim_ext_scan_forward_bcn_probe_rsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info, body + SIR_MAC_B_PR_SSID_OFFSET, ie_len); frame_len = sizeof(*bssdescr) + ie_len - sizeof(bssdescr->ieFields[1]); - bssdescr = (tSirBssDescription *) qdf_mem_malloc(frame_len); + bssdescr = qdf_mem_malloc(frame_len); - if (NULL == bssdescr) { - pe_err("qdf_mem_malloc(length=%d) failed", frame_len); + if (!bssdescr) return; - } qdf_mem_zero(bssdescr, frame_len); @@ -657,10 +633,8 @@ __lim_process_ext_scan_beacon_probe_rsp(tpAniSirGlobal pmac, } frame = qdf_mem_malloc(sizeof(*frame)); - if (NULL == frame) { - pe_err("Memory allocation failed"); + if (!frame) return; - } if (sub_type == SIR_MAC_MGMT_BEACON) { pe_debug("Beacon due to ExtScan/epno"); @@ -795,10 +769,8 @@ static QDF_STATUS lim_allocate_and_get_bcn( cds_pkt_t *pkt_l = NULL; pkt_l = qdf_mem_malloc(sizeof(cds_pkt_t)); - if (!pkt_l) { - pe_err("Failed to allocate pkt"); + if (!pkt_l) return QDF_STATUS_E_FAILURE; - } status = wma_ds_peek_rx_packet_info( pkt_l, (void *)&rx_pkt_info_l, false); @@ -808,10 +780,8 @@ static QDF_STATUS lim_allocate_and_get_bcn( } bcn_l = qdf_mem_malloc(sizeof(tSchBeaconStruct)); - if (!bcn_l) { - pe_err("Failed to allocate bcn struct"); + if (!bcn_l) goto free; - } lim_fill_sap_bcn_pkt_meta(scan_entry, pkt_l); @@ -1420,10 +1390,8 @@ void lim_process_abort_scan_ind(tpAniSirGlobal mac_ctx, } req = qdf_mem_malloc(sizeof(*req)); - if (!req) { - pe_debug("failed to alloc scan cancel request"); + if (!req) goto fail; - } req->vdev = vdev; req->cancel_req.requester = scan_requestor_id; diff --git a/core/mac/src/pe/lim/lim_process_mlm_host_roam.c b/core/mac/src/pe/lim/lim_process_mlm_host_roam.c index 8d68612aaecd..c8dbad2ca2d9 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_host_roam.c +++ b/core/mac/src/pe/lim/lim_process_mlm_host_roam.c @@ -413,8 +413,7 @@ void lim_process_sta_mlm_add_bss_rsp_ft(tpAniSirGlobal pMac, /* Take a copy of reassoc request for retrying */ pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = qdf_mem_malloc(sizeof(tLimMlmReassocReq)); - if (NULL == - pMac->lim.pSessionEntry->pLimMlmReassocRetryReq) + if (!pMac->lim.pSessionEntry->pLimMlmReassocRetryReq) goto end; qdf_mem_copy(pMac->lim.pSessionEntry-> pLimMlmReassocRetryReq, @@ -450,10 +449,8 @@ void lim_process_sta_mlm_add_bss_rsp_ft(tpAniSirGlobal pMac, psessionEntry); pAddStaParams = qdf_mem_malloc(sizeof(tAddStaParams)); - if (NULL == pAddStaParams) { - pe_err("Unable to allocate memory during ADD_STA"); + if (!pAddStaParams) goto end; - } /* / Add STA context at MAC HW (BMU, RHP & TFP) */ qdf_mem_copy((uint8_t *) pAddStaParams->staMac, @@ -617,10 +614,8 @@ void lim_process_mlm_ft_reassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf, return; } pMlmReassocReq = qdf_mem_malloc(sizeof(tLimMlmReassocReq)); - if (NULL == pMlmReassocReq) { - pe_err("call to AllocateMemory failed for mlmReassocReq"); + if (!pMlmReassocReq) return; - } qdf_mem_copy(pMlmReassocReq->peerMacAddr, psessionEntry->bssId, sizeof(tSirMacAddr)); diff --git a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c index 5f92032940a3..613ef3a59824 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c @@ -457,11 +457,8 @@ lim_mlm_add_bss(tpAniSirGlobal mac_ctx, /* Package WMA_ADD_BSS_REQ message parameters */ addbss_param = qdf_mem_malloc(sizeof(tAddBssParams)); - if (NULL == addbss_param) { - pe_err("Unable to allocate memory during ADD_BSS"); - /* Respond to SME with LIM_MLM_START_CNF */ + if (!addbss_param) return eSIR_SME_RESOURCES_UNAVAILABLE; - } /* Fill in tAddBssParams members */ qdf_mem_copy(addbss_param->bssId, mlm_start_req->bssId, @@ -802,12 +799,10 @@ lim_process_mlm_post_join_suspend_link(tpAniSirGlobal mac_ctx, lnk_state); pe_session_param = qdf_mem_malloc(sizeof(struct session_params)); - if (pe_session_param) { - pe_session_param->session_id = session->peSessionId; - } else { - pe_err("insufficient memory"); + if (!pe_session_param) goto error; - } + + pe_session_param->session_id = session->peSessionId; if (lim_set_link_state(mac_ctx, lnk_state, session->pLimMlmJoinReq->bssDescription.bssId, session->selfMacAddr, @@ -1031,10 +1026,8 @@ static QDF_STATUS lim_process_mlm_auth_req_sae(tpAniSirGlobal mac_ctx, struct scheduler_msg msg = {0}; sae_info = qdf_mem_malloc(sizeof(*sae_info)); - if (sae_info == NULL) { - pe_err("Memory allocation failed"); + if (!sae_info) return QDF_STATUS_E_FAILURE; - } sae_info->msg_type = eWNI_SME_TRIGGER_SAE; sae_info->msg_len = sizeof(*sae_info); @@ -1429,8 +1422,7 @@ lim_process_mlm_disassoc_req_ntf(tpAniSirGlobal mac_ctx, */ sme_disassoc_rsp = qdf_mem_malloc(sizeof(tSirSmeDisassocRsp)); - if (NULL == sme_disassoc_rsp) { - pe_err("memory allocation failed for disassoc rsp"); + if (!sme_disassoc_rsp) { qdf_mem_free(mlm_disassocreq); return; } @@ -1780,8 +1772,7 @@ lim_process_mlm_deauth_req_ntf(tpAniSirGlobal mac_ctx, */ sme_deauth_rsp = qdf_mem_malloc(sizeof(tSirSmeDeauthRsp)); - if (NULL == sme_deauth_rsp) { - pe_err("memory allocation failed for deauth rsp"); + if (!sme_deauth_rsp) { qdf_mem_free(mlm_deauth_req); return; } diff --git a/core/mac/src/pe/lim/lim_process_probe_req_frame.c b/core/mac/src/pe/lim/lim_process_probe_req_frame.c index 952218c886cb..e4d665879348 100644 --- a/core/mac/src/pe/lim/lim_process_probe_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_probe_req_frame.c @@ -219,10 +219,8 @@ static void lim_update_pbc_session_entry(tpAniSirGlobal pMac, if (!pbc) { pbc = qdf_mem_malloc(sizeof(tSirWPSPBCSession)); - if (NULL == pbc) { - pe_err("memory allocate failed!"); + if (!pbc) return; - } qdf_mem_copy((uint8_t *) pbc->addr.bytes, (uint8_t *) addr, QDF_MAC_ADDR_SIZE); @@ -634,11 +632,8 @@ lim_send_sme_probe_req_ind(tpAniSirGlobal pMac, struct scheduler_msg msgQ = {0}; pSirSmeProbeReqInd = qdf_mem_malloc(sizeof(tSirSmeProbeReqInd)); - if (NULL == pSirSmeProbeReqInd) { - /* Log error */ - pe_err("call to AllocateMemory failed for eWNI_SME_PROBE_REQ_IND"); + if (!pSirSmeProbeReqInd) return; - } msgQ.type = eWNI_SME_WPS_PBC_PROBE_REQ_IND; msgQ.bodyval = 0; diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 07943cc8996c..f0f08038582a 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -143,13 +143,8 @@ static QDF_STATUS lim_process_set_hw_mode(tpAniSirGlobal mac, uint32_t *msg) len = sizeof(*req_msg); req_msg = qdf_mem_malloc(len); - if (!req_msg) { - pe_err("qdf_mem_malloc failed"); - /* Free the active command list - * Probably the malloc is going to fail there as well?! - */ + if (!req_msg) return QDF_STATUS_E_NOMEM; - } req_msg->hw_mode_index = buf->set_hw.hw_mode_index; req_msg->reason = buf->set_hw.reason; @@ -171,10 +166,8 @@ static QDF_STATUS lim_process_set_hw_mode(tpAniSirGlobal mac, uint32_t *msg) return status; fail: param = qdf_mem_malloc(sizeof(*param)); - if (!param) { - pe_err("HW mode resp failed"); + if (!param) return QDF_STATUS_E_FAILURE; - } param->status = SET_HW_MODE_STATUS_ECANCELED; param->cfgd_hw_mode_index = 0; param->num_vdev_mac_entries = 0; @@ -215,13 +208,8 @@ static QDF_STATUS lim_process_set_dual_mac_cfg_req(tpAniSirGlobal mac, len = sizeof(*req_msg); req_msg = qdf_mem_malloc(len); - if (!req_msg) { - pe_err("qdf_mem_malloc failed"); - /* Free the active command list - * Probably the malloc is going to fail there as well?! - */ + if (!req_msg) return QDF_STATUS_E_NOMEM; - } req_msg->scan_config = buf->set_dual_mac.scan_config; req_msg->fw_mode_config = buf->set_dual_mac.fw_mode_config; @@ -244,10 +232,8 @@ static QDF_STATUS lim_process_set_dual_mac_cfg_req(tpAniSirGlobal mac, return status; fail: param = qdf_mem_malloc(sizeof(*param)); - if (!param) { - pe_err("Dual mac config resp failed"); + if (!param) return QDF_STATUS_E_FAILURE; - } param->status = SET_HW_MODE_STATUS_ECANCELED; resp_msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP; resp_msg.bodyptr = param; @@ -284,10 +270,8 @@ static QDF_STATUS lim_process_set_antenna_mode_req(tpAniSirGlobal mac, } req_msg = qdf_mem_malloc(sizeof(*req_msg)); - if (!req_msg) { - pe_err("qdf_mem_malloc failed"); + if (!req_msg) return QDF_STATUS_E_NOMEM; - } req_msg->num_rx_chains = buf->set_antenna_mode.num_rx_chains; req_msg->num_tx_chains = buf->set_antenna_mode.num_tx_chains; @@ -310,10 +294,8 @@ static QDF_STATUS lim_process_set_antenna_mode_req(tpAniSirGlobal mac, return status; fail: param = qdf_mem_malloc(sizeof(*param)); - if (!param) { - pe_err("antenna mode resp failed"); + if (!param) return QDF_STATUS_E_NOMEM; - } param->status = SET_ANTENNA_MODE_STATUS_ECANCELED; resp_msg.type = eWNI_SME_SET_ANTENNA_MODE_RESP; resp_msg.bodyptr = param; @@ -604,9 +586,7 @@ __lim_handle_sme_start_bss_request(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) pe_debug("Received START_BSS_REQ"); size = sizeof(tSirSmeStartBssReq); sme_start_bss_req = qdf_mem_malloc(size); - if (NULL == sme_start_bss_req) { - pe_err("Allocate Memory fail for LimStartBssReq"); - /* Send failure response to host */ + if (!sme_start_bss_req) { ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto free; } @@ -815,8 +795,7 @@ __lim_handle_sme_start_bss_request(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) session->parsedAssocReq = qdf_mem_malloc(session->dph.dphHashTable. size * sizeof(tpSirAssocReq)); - if (NULL == session->parsedAssocReq) { - pe_warn("AllocateMemory() failed"); + if (!session->parsedAssocReq) { ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto free; } @@ -904,8 +883,7 @@ __lim_handle_sme_start_bss_request(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) } /* Prepare and Issue LIM_MLM_START_REQ to MLM */ mlm_start_req = qdf_mem_malloc(sizeof(tLimMlmStartReq)); - if (NULL == mlm_start_req) { - pe_err("Allocate Memory failed for mlmStartReq"); + if (!mlm_start_req) { ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto free; } @@ -1279,8 +1257,7 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) msg_buf); sme_join_req = qdf_mem_malloc(n_size); - if (NULL == sme_join_req) { - pe_err("AllocateMemory failed for sme_join_req"); + if (!sme_join_req) { ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto end; } @@ -1569,8 +1546,7 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) val = sizeof(tLimMlmJoinReq) + session->pLimJoinReq->bssDescription.length + 2; mlm_join_req = qdf_mem_malloc(val); - if (NULL == mlm_join_req) { - pe_err("AllocateMemory failed for mlmJoinReq"); + if (!mlm_join_req) { ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto end; } @@ -1780,9 +1756,7 @@ static void __lim_process_sme_reassoc_req(tpAniSirGlobal mac_ctx, size = __lim_get_sme_join_req_size_for_alloc((uint8_t *)msg_buf); reassoc_req = qdf_mem_malloc(size); - if (NULL == reassoc_req) { - pe_err("call to AllocateMemory failed for reassoc_req"); - + if (!reassoc_req) { ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto end; } @@ -1950,9 +1924,7 @@ static void __lim_process_sme_reassoc_req(tpAniSirGlobal mac_ctx, } mlm_reassoc_req = qdf_mem_malloc(sizeof(tLimMlmReassocReq)); - if (NULL == mlm_reassoc_req) { - pe_err("call to AllocateMemory failed for mlmReassocReq"); - + if (!mlm_reassoc_req) { ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto end; } @@ -2228,10 +2200,8 @@ static void __lim_process_sme_disassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBu disassocTrigger, reasonCode); pMlmDisassocReq = qdf_mem_malloc(sizeof(tLimMlmDisassocReq)); - if (NULL == pMlmDisassocReq) { - pe_err("call to AllocateMemory failed for mlmDisassocReq"); + if (!pMlmDisassocReq) return; - } qdf_copy_macaddr(&pMlmDisassocReq->peer_macaddr, &smeDisassocReq.peer_macaddr); @@ -2588,8 +2558,7 @@ static void __lim_process_sme_deauth_req(tpAniSirGlobal mac_ctx, /* Trigger Deauthentication frame to peer MAC entity */ mlm_deauth_req = qdf_mem_malloc(sizeof(tLimMlmDeauthReq)); - if (NULL == mlm_deauth_req) { - pe_err("call to AllocateMemory failed for mlmDeauthReq"); + if (!mlm_deauth_req) { if (mac_ctx->lim.gLimRspReqd) { mac_ctx->lim.gLimRspReqd = false; ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; @@ -2645,10 +2614,8 @@ __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) } set_context_req = qdf_mem_malloc(sizeof(struct sSirSmeSetContextReq)); - if (NULL == set_context_req) { - pe_err("call to AllocateMemory failed for set_context_req"); + if (!set_context_req) return; - } qdf_mem_copy(set_context_req, msg_buf, sizeof(struct sSirSmeSetContextReq)); sme_session_id = set_context_req->sessionId; @@ -2692,10 +2659,8 @@ __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) (session_entry->limSmeState == eLIM_SME_NORMAL_STATE))) { /* Trigger MLM_SETKEYS_REQ */ mlm_set_key_req = qdf_mem_malloc(sizeof(tLimMlmSetKeysReq)); - if (NULL == mlm_set_key_req) { - pe_err("mem alloc failed for mlmSetKeysReq"); + if (!mlm_set_key_req) goto end; - } mlm_set_key_req->edType = set_context_req->keyMaterial.edType; mlm_set_key_req->numKeys = set_context_req->keyMaterial.numKeys; @@ -3798,10 +3763,8 @@ lim_send_vdev_restart(tpAniSirGlobal pMac, pHalHiddenSsidVdevRestart = qdf_mem_malloc(sizeof(tHalHiddenSsidVdevRestart)); - if (NULL == pHalHiddenSsidVdevRestart) { - pe_err("Unable to allocate memory"); + if (!pHalHiddenSsidVdevRestart) return; - } pHalHiddenSsidVdevRestart->ssidHidden = psessionEntry->ssidHidden; pHalHiddenSsidVdevRestart->sessionId = sessionId; @@ -3841,7 +3804,6 @@ static void __lim_process_roam_scan_offload_req(tpAniSirGlobal mac_ctx, local_ie_buf = qdf_mem_malloc(MAX_DEFAULT_SCAN_IE_LEN); if (!local_ie_buf) { - pe_err("Mem Alloc failed for local_ie_buf"); qdf_mem_free(req_buffer); return; } @@ -4085,10 +4047,8 @@ static void __lim_process_sme_set_ht2040_mode(tpAniSirGlobal pMac, if (pStaDs->valid && pStaDs->htSupportedChannelWidthSet) { pHtOpMode = qdf_mem_malloc(sizeof(tUpdateVHTOpMode)); - if (NULL == pHtOpMode) { - pe_err("Not able to allocate memory for setting OP mode"); + if (!pHtOpMode) return; - } pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED) ? @@ -4182,11 +4142,8 @@ lim_send_set_max_tx_power_req(tpAniSirGlobal pMac, int8_t txPower, } pMaxTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); - if (NULL == pMaxTxParams) { - pe_err("Unable to allocate memory for pMaxTxParams"); + if (!pMaxTxParams) return QDF_STATUS_E_NOMEM; - - } pMaxTxParams->power = txPower; qdf_mem_copy(pMaxTxParams->bssId.bytes, pSessionEntry->bssId, QDF_MAC_ADDR_SIZE); @@ -4434,19 +4391,16 @@ static void lim_set_pdev_ht_ie(tpAniSirGlobal mac_ctx, uint8_t pdev_id, for (i = 1; i <= nss; i++) { ie_params = qdf_mem_malloc(sizeof(*ie_params)); - if (NULL == ie_params) { - pe_err("mem alloc failed"); + if (!ie_params) return; - } ie_params->nss = i; ie_params->pdev_id = pdev_id; ie_params->ie_type = DOT11_HT_IE; /* 2 for IE len and EID */ ie_params->ie_len = 2 + sizeof(tHtCaps); ie_params->ie_ptr = qdf_mem_malloc(ie_params->ie_len); - if (NULL == ie_params->ie_ptr) { + if (!ie_params->ie_ptr) { qdf_mem_free(ie_params); - pe_err("mem alloc failed"); return; } *ie_params->ie_ptr = SIR_MAC_HT_CAPABILITIES_EID; @@ -4506,10 +4460,8 @@ static void lim_set_pdev_vht_ie(tpAniSirGlobal mac_ctx, uint8_t pdev_id, for (i = 1; i <= nss; i++) { ie_params = qdf_mem_malloc(sizeof(*ie_params)); - if (NULL == ie_params) { - pe_err("mem alloc failed"); + if (!ie_params) return; - } ie_params->nss = i; ie_params->pdev_id = pdev_id; ie_params->ie_type = DOT11_VHT_IE; @@ -4517,9 +4469,8 @@ static void lim_set_pdev_vht_ie(tpAniSirGlobal mac_ctx, uint8_t pdev_id, ie_params->ie_len = 2 + sizeof(tSirMacVHTCapabilityInfo) + sizeof(tSirVhtMcsInfo); ie_params->ie_ptr = qdf_mem_malloc(ie_params->ie_len); - if (NULL == ie_params->ie_ptr) { + if (!ie_params->ie_ptr) { qdf_mem_free(ie_params); - pe_err("mem alloc failed"); return; } *ie_params->ie_ptr = SIR_MAC_VHT_CAPABILITIES_EID; @@ -4660,11 +4611,8 @@ static void lim_process_sme_update_access_policy_vendor_ie( num_bytes = update_vendor_ie->ie[1] + 2; pe_session_entry->access_policy_vendor_ie = qdf_mem_malloc(num_bytes); - - if (!pe_session_entry->access_policy_vendor_ie) { - pe_err("Failed to allocate memory for vendor ie"); + if (!pe_session_entry->access_policy_vendor_ie) return; - } qdf_mem_copy(pe_session_entry->access_policy_vendor_ie, &update_vendor_ie->ie[0], num_bytes); @@ -5259,11 +5207,8 @@ lim_start_bss_update_add_ie_buffer(tpAniSirGlobal pMac, *pDstDataLen = srcDataLen; *pDstData_buff = qdf_mem_malloc(*pDstDataLen); - - if (NULL == *pDstData_buff) { - pe_err("AllocateMemory failed for pDstData_buff"); + if (!*pDstData_buff) return; - } qdf_mem_copy(*pDstData_buff, pSrcData_buff, *pDstDataLen); } else { *pDstData_buff = NULL; @@ -5311,9 +5256,7 @@ lim_update_add_ie_buffer(tpAniSirGlobal pMac, qdf_mem_free(*pDstData_buff); /* allocate a new */ *pDstData_buff = qdf_mem_malloc(*pDstDataLen); - - if (NULL == *pDstData_buff) { - pe_err("Memory allocation failed"); + if (!*pDstData_buff) { *pDstDataLen = 0; return; } @@ -5385,10 +5328,8 @@ lim_update_ibss_prop_add_ies(tpAniSirGlobal pMac, uint8_t **pDstData_buff, new_length = pModifyIE->ieBufferlength + *pDstDataLen; new_ptr = qdf_mem_malloc(new_length); - if (NULL == new_ptr) { - pe_err("Memory allocation failed"); + if (!new_ptr) return false; - } qdf_mem_copy(new_ptr, *pDstData_buff, *pDstDataLen); qdf_mem_copy(&new_ptr[*pDstDataLen], pModifyIE->pIEBuffer, pModifyIE->ieBufferlength); @@ -5573,10 +5514,8 @@ static void lim_process_update_add_ies(tpAniSirGlobal mac_ctx, new_length = update_ie->ieBufferlength + addn_ie->probeRespDataLen; new_ptr = qdf_mem_malloc(new_length); - if (NULL == new_ptr) { - pe_err("Memory allocation failed"); + if (!new_ptr) goto end; - } /* append buffer to end of local buffers */ qdf_mem_copy(new_ptr, addn_ie->probeRespData_buff, addn_ie->probeRespDataLen); @@ -6223,10 +6162,8 @@ void lim_send_obss_color_collision_cfg(tpAniSirGlobal mac_ctx, } cfg_param = qdf_mem_malloc(sizeof(*cfg_param)); - if (!cfg_param) { - pe_err("Failed to allocate memory"); + if (!cfg_param) return; - } pe_debug("%d: sending event:%d", session->smeSessionId, event_type); qdf_mem_zero(cfg_param, sizeof(*cfg_param)); diff --git a/core/mac/src/pe/lim/lim_process_tdls.c b/core/mac/src/pe/lim/lim_process_tdls.c index 50c1a37df7bb..9e028ce47368 100644 --- a/core/mac/src/pe/lim/lim_process_tdls.c +++ b/core/mac/src/pe/lim/lim_process_tdls.c @@ -2685,10 +2685,8 @@ static QDF_STATUS lim_send_sme_tdls_add_sta_rsp(tpAniSirGlobal pMac, mmhMsg.type = eWNI_SME_TDLS_ADD_STA_RSP; addStaRsp = qdf_mem_malloc(sizeof(tSirTdlsAddStaRsp)); - if (NULL == addStaRsp) { - pe_err("Failed to allocate memory"); + if (!addStaRsp) return QDF_STATUS_E_NOMEM; - } addStaRsp->sessionId = sessionId; addStaRsp->statusCode = status; @@ -2786,12 +2784,8 @@ lim_send_tdls_comp_mgmt_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, lim_msg_str(msg_type), lim_result_code_str(result_code)); sme_rsp = qdf_mem_malloc(sizeof(tSirSmeRsp)); - if (NULL == sme_rsp) { - /* Buffer not available. Log error */ - QDF_TRACE(QDF_MODULE_ID_PE, LOGP, - FL("call to AllocateMemory failed for eWNI_SME_*_RSP")); + if (!sme_rsp) return; - } sme_rsp->messageType = msg_type; sme_rsp->length = sizeof(tSirSmeRsp); @@ -2956,10 +2950,8 @@ static QDF_STATUS lim_send_sme_tdls_del_sta_rsp(tpAniSirGlobal pMac, mmhMsg.type = eWNI_SME_TDLS_DEL_STA_RSP; pDelSta = qdf_mem_malloc(sizeof(tSirTdlsDelStaRsp)); - if (NULL == pDelSta) { - pe_err("Failed to allocate memory"); + if (!pDelSta) return QDF_STATUS_E_NOMEM; - } pDelSta->sessionId = sessionId; pDelSta->statusCode = status; diff --git a/core/mac/src/pe/lim/lim_prop_exts_utils.c b/core/mac/src/pe/lim/lim_prop_exts_utils.c index daab386497d7..0033911adc10 100644 --- a/core/mac/src/pe/lim/lim_prop_exts_utils.c +++ b/core/mac/src/pe/lim/lim_prop_exts_utils.c @@ -209,10 +209,8 @@ lim_extract_ap_capability(tpAniSirGlobal mac_ctx, uint8_t *p_ie, struct s_ext_cap *ext_cap; beacon_struct = qdf_mem_malloc(sizeof(tSirProbeRespBeacon)); - if (NULL == beacon_struct) { - pe_err("Unable to allocate memory"); + if (!beacon_struct) return; - } *qos_cap = 0; *prop_cap = 0; diff --git a/core/mac/src/pe/lim/lim_reassoc_utils.c b/core/mac/src/pe/lim/lim_reassoc_utils.c index 789ecf80dad9..a94108f8accd 100644 --- a/core/mac/src/pe/lim/lim_reassoc_utils.c +++ b/core/mac/src/pe/lim/lim_reassoc_utils.c @@ -129,8 +129,7 @@ void lim_handle_del_bss_in_re_assoc_context(tpAniSirGlobal pMac, tpSchBeaconStruct beacon_struct; beacon_struct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); - if (NULL == beacon_struct) { - pe_err("beaconStruct alloc failed"); + if (!beacon_struct) { mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; mlmReassocCnf.protStatusCode = @@ -261,8 +260,7 @@ void lim_handle_add_bss_in_re_assoc_context(tpAniSirGlobal pMac, pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); - if (NULL == pBeaconStruct) { - pe_err("Unable to allocate memory"); + if (!pBeaconStruct) { mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; mlmReassocCnf.protStatusCode = diff --git a/core/mac/src/pe/lim/lim_security_utils.c b/core/mac/src/pe/lim/lim_security_utils.c index a28c78c801b9..158c1dd51e00 100644 --- a/core/mac/src/pe/lim/lim_security_utils.c +++ b/core/mac/src/pe/lim/lim_security_utils.c @@ -782,9 +782,7 @@ void lim_send_set_bss_key_req(tpAniSirGlobal pMac, /* Package WMA_SET_BSSKEY_REQ message parameters */ pSetBssKeyParams = qdf_mem_malloc(sizeof(tSetBssKeyParams)); - if (NULL == pSetBssKeyParams) { - pe_err("Unable to allocate memory during SET_BSSKEY"); - + if (!pSetBssKeyParams) { /* Respond to SME with error code */ mlmSetKeysCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; goto end; @@ -877,10 +875,8 @@ void lim_send_set_sta_key_req(tpAniSirGlobal pMac, /* Package WMA_SET_STAKEY_REQ message parameters */ pSetStaKeyParams = qdf_mem_malloc(sizeof(tSetStaKeyParams)); - if (NULL == pSetStaKeyParams) { - pe_err("Unable to allocate memory during SET_BSSKEY"); + if (!pSetStaKeyParams) goto fail; - } /* Update the WMA_SET_STAKEY_REQ parameters */ pSetStaKeyParams->staIdx = staIdx; diff --git a/core/mac/src/pe/lim/lim_send_frames_host_roam.c b/core/mac/src/pe/lim/lim_send_frames_host_roam.c index 3a1c9622769f..9b63e5cb1139 100644 --- a/core/mac/src/pe/lim/lim_send_frames_host_roam.c +++ b/core/mac/src/pe/lim/lim_send_frames_host_roam.c @@ -97,10 +97,8 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(tpAniSirGlobal mac_ctx, return; frm = qdf_mem_malloc(sizeof(*frm)); - if (!frm) { - pe_err("mem alloc failed"); + if (!frm) goto err; - } add_ie_len = pe_session->pLimReAssocReq->addIEAssoc.length; add_ie = pe_session->pLimReAssocReq->addIEAssoc.addIEdata; @@ -387,9 +385,7 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(tpAniSirGlobal mac_ctx, } pe_session->assocReq = qdf_mem_malloc(payload); - if (NULL == pe_session->assocReq) { - pe_err("Failed to alloc memory"); - } else { + if (pe_session->assocReq) { /* * Store the Assoc request. This is sent to csr/hdd in * join cnf response. @@ -429,8 +425,7 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(tpAniSirGlobal mac_ctx, } if (ft_ies_length) { pe_session->assocReq = qdf_mem_malloc(ft_ies_length); - if (NULL == pe_session->assocReq) { - pe_err("Failed to alloc memory for FT IEs"); + if (!pe_session->assocReq) { pe_session->assocReqLen = 0; } else { /* @@ -572,10 +567,8 @@ void lim_send_reassoc_req_mgmt_frame(tpAniSirGlobal pMac, return; frm = qdf_mem_malloc(sizeof(*frm)); - if (!frm) { - pe_err("mem alloc failed"); + if (!frm) goto err; - } nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; @@ -763,9 +756,7 @@ void lim_send_reassoc_req_mgmt_frame(tpAniSirGlobal pMac, } psessionEntry->assocReq = qdf_mem_malloc(nPayload); - if (NULL == psessionEntry->assocReq) { - pe_err("Unable to allocate mem for assoc req"); - } else { + if (psessionEntry->assocReq) { /* Store the Assocrequest. It is sent to csr in joincnfrsp */ qdf_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 60056a2f62f9..5e8ce36779c2 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -480,10 +480,8 @@ static QDF_STATUS lim_get_addn_ie_for_probe_resp(tpAniSirGlobal pMac, } tempbuf = qdf_mem_malloc(left); - if (NULL == tempbuf) { - pe_err("Unable to allocate memory to store addn IE"); + if (!tempbuf) return QDF_STATUS_E_NOMEM; - } while (left >= 2) { elem_id = ptr[0]; @@ -580,10 +578,8 @@ lim_send_probe_rsp_mgmt_frame(tpAniSirGlobal mac_ctx, } sme_sessionid = pe_session->smeSessionId; frm = qdf_mem_malloc(sizeof(tDot11fProbeResponse)); - if (NULL == frm) { - pe_err("Unable to allocate memory"); + if (!frm) return; - } /* * Fill out 'frm', after which we'll just hand the struct off to @@ -720,10 +716,8 @@ lim_send_probe_rsp_mgmt_frame(tpAniSirGlobal mac_ctx, add_ie = qdf_mem_malloc( pe_session->addIeParams.probeRespDataLen); - if (NULL == add_ie) { - pe_err("add_ie allocation failed"); + if (!add_ie) goto err_ret; - } qdf_mem_copy(add_ie, pe_session->addIeParams.probeRespData_buff, @@ -1672,8 +1666,7 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, add_ie = pe_session->pLimJoinReq->addIEAssoc.addIEdata; frm = qdf_mem_malloc(sizeof(tDot11fAssocRequest)); - if (NULL == frm) { - pe_err("Unable to allocate memory"); + if (!frm) { qdf_mem_free(mlm_assoc_req); return; } @@ -1971,10 +1964,8 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, if (wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_MBO_OUI, SIR_MAC_MBO_OUI_SIZE, add_ie, add_ie_len)) { mbo_ie = qdf_mem_malloc(DOT11F_IE_MBO_IE_MAX_LEN + 2); - if (!mbo_ie) { - pe_err("Failed to allocate mbo_ie"); + if (!mbo_ie) goto end; - } qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, SIR_MAC_EID_VENDOR, ONE_BYTE, @@ -2079,9 +2070,7 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, } pe_session->assocReq = qdf_mem_malloc(payload); - if (NULL == pe_session->assocReq) { - pe_err("Unable to allocate memory"); - } else { + if (pe_session->assocReq) { /* * Store the Assoc request. This is sent to csr/hdd in * join cnf response. @@ -4372,10 +4361,8 @@ lim_send_radio_measure_report_action_frame(tpAniSirGlobal pMac, tDot11fRadioMeasurementReport *frm = qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); - if (!frm) { - pe_err("Not enough memory to allocate tDot11fRadioMeasurementReport"); + if (!frm) return QDF_STATUS_E_NOMEM; - } if (psessionEntry == NULL) { pe_err("(psession == NULL) in Request to send Beacon Report action frame"); diff --git a/core/mac/src/pe/lim/lim_send_messages.c b/core/mac/src/pe/lim/lim_send_messages.c index 44f274084f1e..e50a4404dac3 100644 --- a/core/mac/src/pe/lim/lim_send_messages.c +++ b/core/mac/src/pe/lim/lim_send_messages.c @@ -65,11 +65,8 @@ QDF_STATUS lim_send_cf_params(tpAniSirGlobal pMac, uint8_t bssIdx, struct scheduler_msg msgQ = {0}; pCFParams = qdf_mem_malloc(sizeof(tUpdateCFParams)); - if (NULL == pCFParams) { - pe_err("Unable to allocate memory during Update CF Params"); - retCode = QDF_STATUS_E_NOMEM; - goto returnFailure; - } + if (!pCFParams) + return QDF_STATUS_E_NOMEM; pCFParams->cfpCount = cfpCount; pCFParams->cfpPeriod = cfpPeriod; pCFParams->bssIdx = bssIdx; @@ -86,7 +83,6 @@ QDF_STATUS lim_send_cf_params(tpAniSirGlobal pMac, uint8_t bssIdx, pe_err("Posting WMA_UPDATE_CF_IND failed, reason=%X", retCode); } -returnFailure: return retCode; } @@ -111,10 +107,8 @@ QDF_STATUS lim_send_beacon_params(tpAniSirGlobal pMac, struct scheduler_msg msgQ = {0}; pBcnParams = qdf_mem_malloc(sizeof(*pBcnParams)); - if (NULL == pBcnParams) { - pe_err("Unable to allocate memory during Update Beacon Params"); + if (!pBcnParams) return QDF_STATUS_E_NOMEM; - } qdf_mem_copy((uint8_t *) pBcnParams, pUpdatedBcnParams, sizeof(*pBcnParams)); msgQ.type = WMA_UPDATE_BEACON_IND; @@ -186,10 +180,8 @@ QDF_STATUS lim_send_switch_chnl_params(tpAniSirGlobal pMac, return QDF_STATUS_E_FAILURE; } pChnlParams = qdf_mem_malloc(sizeof(tSwitchChannelParams)); - if (NULL == pChnlParams) { - pe_err("Unable to allocate memory for Switch Ch Params"); + if (!pChnlParams) return QDF_STATUS_E_NOMEM; - } pChnlParams->channelNumber = chnlNumber; pChnlParams->ch_center_freq_seg0 = ch_center_freq_seg0; pChnlParams->ch_center_freq_seg1 = ch_center_freq_seg1; @@ -292,11 +284,8 @@ QDF_STATUS lim_send_edca_params(tpAniSirGlobal pMac, struct scheduler_msg msgQ = {0}; pEdcaParams = qdf_mem_malloc(sizeof(tEdcaParams)); - if (NULL == pEdcaParams) { - pe_err("Unable to allocate memory during Update EDCA Params"); - retCode = QDF_STATUS_E_NOMEM; - return retCode; - } + if (!pEdcaParams) + return QDF_STATUS_E_NOMEM; pEdcaParams->bssIdx = bssIdx; pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE]; pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK]; @@ -451,11 +440,8 @@ QDF_STATUS lim_set_link_state(tpAniSirGlobal pMac, tSirLinkState state, tpLinkStateParams pLinkStateParams = NULL; /* Allocate memory. */ pLinkStateParams = qdf_mem_malloc(sizeof(tLinkStateParams)); - if (NULL == pLinkStateParams) { - pe_err("Unable to allocate memory while sending Set Link State"); - retCode = QDF_STATUS_E_NOMEM; - return retCode; - } + if (!pLinkStateParams) + return QDF_STATUS_E_NOMEM; pLinkStateParams->state = state; pLinkStateParams->callback = callback; pLinkStateParams->callbackArg = callbackArg; @@ -490,11 +476,8 @@ extern QDF_STATUS lim_set_link_state_ft(tpAniSirGlobal pMac, tSirLinkState tpLinkStateParams pLinkStateParams = NULL; /* Allocate memory. */ pLinkStateParams = qdf_mem_malloc(sizeof(tLinkStateParams)); - if (NULL == pLinkStateParams) { - pe_err("Unable to allocate memory while sending Set Link State"); - retCode = QDF_STATUS_E_NOMEM; - return retCode; - } + if (!pLinkStateParams) + return QDF_STATUS_E_NOMEM; pLinkStateParams->state = state; /* Copy Mac address */ sir_copy_mac_addr(pLinkStateParams->bssid, bssId); @@ -531,10 +514,8 @@ QDF_STATUS lim_send_mode_update(tpAniSirGlobal pMac, struct scheduler_msg msgQ = {0}; pVhtOpMode = qdf_mem_malloc(sizeof(tUpdateVHTOpMode)); - if (NULL == pVhtOpMode) { - pe_err("Unable to allocate memory during Update Op Mode"); + if (!pVhtOpMode) return QDF_STATUS_E_NOMEM; - } qdf_mem_copy((uint8_t *) pVhtOpMode, pTempParam, sizeof(tUpdateVHTOpMode)); msgQ.type = WMA_UPDATE_OP_MODE; @@ -568,10 +549,8 @@ QDF_STATUS lim_send_rx_nss_update(tpAniSirGlobal pMac, struct scheduler_msg msgQ = {0}; pRxNss = qdf_mem_malloc(sizeof(tUpdateRxNss)); - if (NULL == pRxNss) { - pe_err("Unable to allocate memory during Update Rx Nss"); + if (!pRxNss) return QDF_STATUS_E_NOMEM; - } qdf_mem_copy((uint8_t *) pRxNss, pTempParam, sizeof(tUpdateRxNss)); msgQ.type = WMA_UPDATE_RX_NSS; msgQ.reserved = 0; @@ -603,10 +582,8 @@ QDF_STATUS lim_set_membership(tpAniSirGlobal pMac, struct scheduler_msg msgQ = {0}; pMembership = qdf_mem_malloc(sizeof(tUpdateMembership)); - if (NULL == pMembership) { - pe_err("Unable to allocate memory during Update Membership Mode"); + if (!pMembership) return QDF_STATUS_E_NOMEM; - } qdf_mem_copy((uint8_t *) pMembership, pTempParam, sizeof(tUpdateMembership)); @@ -640,10 +617,8 @@ QDF_STATUS lim_set_user_pos(tpAniSirGlobal pMac, struct scheduler_msg msgQ = {0}; pUserPos = qdf_mem_malloc(sizeof(tUpdateUserPos)); - if (NULL == pUserPos) { - pe_err("Unable to allocate memory during Update User Position"); + if (!pUserPos) return QDF_STATUS_E_NOMEM; - } qdf_mem_copy((uint8_t *) pUserPos, pTempParam, sizeof(tUpdateUserPos)); msgQ.type = WMA_UPDATE_USERPOS; @@ -689,9 +664,8 @@ QDF_STATUS lim_send_exclude_unencrypt_ind(tpAniSirGlobal pMac, pExcludeUnencryptParam = qdf_mem_malloc(sizeof(tSirWlanExcludeUnencryptParam)); - if (NULL == pExcludeUnencryptParam) { + if (!pExcludeUnencryptParam) return QDF_STATUS_E_NOMEM; - } pExcludeUnencryptParam->excludeUnencrypt = excludeUnenc; qdf_mem_copy(pExcludeUnencryptParam->bssid.bytes, psessionEntry->bssId, @@ -734,11 +708,8 @@ QDF_STATUS lim_send_ht40_obss_scanind(tpAniSirGlobal mac_ctx, uint8_t channel24gnum, count; ht40_obss_scanind = qdf_mem_malloc(sizeof(struct obss_ht40_scanind)); - if (NULL == ht40_obss_scanind) { - QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, - "Memory allocation failed"); + if (!ht40_obss_scanind) return QDF_STATUS_E_FAILURE; - } QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, "OBSS Scan Indication bssIdx- %d staId %d", session->bssIdx, session->staId); diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 062d9b226a27..41a3711e94b8 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -88,11 +88,8 @@ lim_send_sme_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, lim_msg_str(msg_type), lim_result_code_str(result_code)); sme_rsp = qdf_mem_malloc(sizeof(tSirSmeRsp)); - if (NULL == sme_rsp) { - /* Buffer not available. Log error */ - pe_err("call to AllocateMemory failed for eWNI_SME_*_RSP"); + if (!sme_rsp) return; - } sme_rsp->messageType = msg_type; sme_rsp->length = sizeof(tSirSmeRsp); @@ -146,10 +143,8 @@ lim_send_sme_roc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, scan_id); sme_rsp = qdf_mem_malloc(sizeof(struct sir_roc_rsp)); - if (NULL == sme_rsp) { - pe_err("call to AllocateMemory failed for eWNI_SME_*_RSP"); + if (!sme_rsp) return; - } sme_rsp->message_type = msg_type; sme_rsp->length = sizeof(struct sir_roc_rsp); @@ -499,10 +494,8 @@ lim_send_sme_join_reassoc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, if (session_entry == NULL) { rsp_len = sizeof(tSirSmeJoinRsp); sme_join_rsp = qdf_mem_malloc(rsp_len); - if (NULL == sme_join_rsp) { - pe_err("Mem Alloc fail - JOIN/REASSOC_RSP"); + if (!sme_join_rsp) return; - } sme_join_rsp->beaconLength = 0; sme_join_rsp->assocReqLength = 0; @@ -516,10 +509,8 @@ lim_send_sme_join_reassoc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, #endif sizeof(tSirSmeJoinRsp) - sizeof(uint8_t); sme_join_rsp = qdf_mem_malloc(rsp_len); - if (NULL == sme_join_rsp) { - pe_err("MemAlloc fail - JOIN/REASSOC_RSP"); + if (!sme_join_rsp) return; - } if (lim_is_fils_connection(session_entry)) { sme_join_rsp->is_fils_connection = true; @@ -629,11 +620,8 @@ lim_send_sme_start_bss_rsp(tpAniSirGlobal pMac, if (psessionEntry == NULL) { pSirSmeRsp = qdf_mem_malloc(size); - if (NULL == pSirSmeRsp) { - /* / Buffer not available. Log error */ - pe_err("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"); + if (!pSirSmeRsp) return; - } } else { /* subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID */ ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET; @@ -643,11 +631,8 @@ lim_send_sme_start_bss_rsp(tpAniSirGlobal pMac, size += ieLen; pSirSmeRsp = qdf_mem_malloc(size); - if (NULL == pSirSmeRsp) { - /* / Buffer not available. Log error */ - pe_err("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"); + if (!pSirSmeRsp) return; - } size = sizeof(tSirSmeStartBssRsp); if (resultCode == eSIR_SME_SUCCESS) { @@ -861,9 +846,7 @@ lim_send_sme_disassoc_ntf(tpAniSirGlobal pMac, */ pSirSmeDisassocRsp = qdf_mem_malloc(sizeof(tSirSmeDisassocRsp)); - if (NULL == pSirSmeDisassocRsp) { - /* Log error */ - pe_err("Memory allocation failed"); + if (!pSirSmeDisassocRsp) { failure = true; goto error; } @@ -917,9 +900,7 @@ lim_send_sme_disassoc_ntf(tpAniSirGlobal pMac, * loss of link with peer entity. */ pSirSmeDisassocInd = qdf_mem_malloc(sizeof(tSirSmeDisassocInd)); - if (NULL == pSirSmeDisassocInd) { - /* Log error */ - pe_err("Memory allocation failed"); + if (!pSirSmeDisassocInd) { failure = true; goto error; } @@ -981,10 +962,8 @@ lim_send_sme_disassoc_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirSmeDisassocInd *pSirSmeDisassocInd; pSirSmeDisassocInd = qdf_mem_malloc(sizeof(tSirSmeDisassocInd)); - if (NULL == pSirSmeDisassocInd) { - pe_err("AllocateMemory failed for eWNI_SME_DISASSOC_IND"); + if (!pSirSmeDisassocInd) return; - } pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND; pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd); @@ -1037,10 +1016,8 @@ lim_send_sme_deauth_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirSmeDeauthInd *pSirSmeDeauthInd; pSirSmeDeauthInd = qdf_mem_malloc(sizeof(tSirSmeDeauthInd)); - if (NULL == pSirSmeDeauthInd) { - pe_err("AllocateMemory failed for eWNI_SME_DEAUTH_IND"); + if (!pSirSmeDeauthInd) return; - } pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd); @@ -1149,10 +1126,8 @@ lim_send_sme_mgmt_tx_completion(tpAniSirGlobal pMac, pSirMgmtTxCompletionInd = qdf_mem_malloc(sizeof(tSirMgmtTxCompletionInd)); - if (NULL == pSirMgmtTxCompletionInd) { - pe_err("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"); + if (!pSirMgmtTxCompletionInd) return; - } /* messageType */ pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND; @@ -1186,10 +1161,8 @@ QDF_STATUS lim_prepare_disconnect_done_ind(tpAniSirGlobal mac_ctx, struct sir_sme_discon_done_ind *sir_sme_dis_ind; sir_sme_dis_ind = qdf_mem_malloc(sizeof(*sir_sme_dis_ind)); - if (!sir_sme_dis_ind) { - pe_err("Failed to allocate memory"); + if (!sir_sme_dis_ind) return QDF_STATUS_E_FAILURE; - } pe_debug("Prepare eWNI_SME_DISCONNECT_DONE_IND withretCode: %d", reason_code); @@ -1265,11 +1238,8 @@ lim_send_sme_deauth_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, * deauthentication. */ pSirSmeDeauthRsp = qdf_mem_malloc(sizeof(tSirSmeDeauthRsp)); - if (NULL == pSirSmeDeauthRsp) { - /* Log error */ - pe_err("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"); + if (!pSirSmeDeauthRsp) return; - } pe_debug("send eWNI_SME_DEAUTH_RSP with retCode: %d for" MAC_ADDRESS_STR, reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP; @@ -1306,11 +1276,8 @@ lim_send_sme_deauth_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, * loss of link with peer entity. */ pSirSmeDeauthInd = qdf_mem_malloc(sizeof(tSirSmeDeauthInd)); - if (NULL == pSirSmeDeauthInd) { - /* Log error */ - pe_err("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"); + if (!pSirSmeDeauthInd) return; - } pe_debug("send eWNI_SME_DEAUTH_IND with retCode: %d for " MAC_ADDRESS_STR, reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; @@ -1381,10 +1348,8 @@ lim_send_sme_wm_status_change_ntf(tpAniSirGlobal mac_ctx, uint32_t max_info_len; wm_status_change_ntf = qdf_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf)); - if (NULL == wm_status_change_ntf) { - pe_err("Mem Alloc failed - eWNI_SME_WM_STATUS_CHANGE_NTF"); + if (!wm_status_change_ntf) return; - } msg.type = eWNI_SME_WM_STATUS_CHANGE_NTF; msg.bodyval = 0; @@ -1466,11 +1431,8 @@ lim_send_sme_set_context_rsp(tpAniSirGlobal pMac, tSirSmeSetContextRsp *pSirSmeSetContextRsp; pSirSmeSetContextRsp = qdf_mem_malloc(sizeof(tSirSmeSetContextRsp)); - if (NULL == pSirSmeSetContextRsp) { - /* Log error */ - pe_err("call to AllocateMemory failed for SmeSetContextRsp"); + if (!pSirSmeSetContextRsp) return; - } pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP; pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp); @@ -1523,10 +1485,8 @@ lim_send_sme_addts_rsp(tpAniSirGlobal pMac, uint8_t rspReqd, uint32_t status, return; rsp = qdf_mem_malloc(sizeof(tSirAddtsRsp)); - if (NULL == rsp) { - pe_err("AllocateMemory failed for ADDTS_RSP"); + if (!rsp) return; - } rsp->messageType = eWNI_SME_ADDTS_RSP; rsp->rc = status; @@ -1571,11 +1531,8 @@ lim_send_sme_delts_rsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, uint32_t status return; rsp = qdf_mem_malloc(sizeof(tSirDeltsRsp)); - if (NULL == rsp) { - /* Log error */ - pe_err("AllocateMemory failed for DELTS_RSP"); + if (!rsp) return; - } if (psessionEntry != NULL) { @@ -1621,11 +1578,8 @@ lim_send_sme_delts_ind(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, uint16_t ai aid, delts->tsinfo.traffic.tsid, delts->tsinfo.traffic.userPrio); rsp = qdf_mem_malloc(sizeof(tSirDeltsRsp)); - if (NULL == rsp) { - /* Log error */ - pe_err("AllocateMemory failed for DELTS_IND"); + if (!rsp) return; - } rsp->messageType = eWNI_SME_DELTS_IND; rsp->rc = QDF_STATUS_SUCCESS; @@ -1773,10 +1727,8 @@ lim_send_sme_ibss_peer_ind(tpAniSirGlobal pMac, tSmeIbssPeerInd *pNewPeerInd; pNewPeerInd = qdf_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen); - if (NULL == pNewPeerInd) { - pe_err("Failed to allocate memory"); + if (!pNewPeerInd) return; - } qdf_mem_copy((uint8_t *) pNewPeerInd->peer_addr.bytes, peerMacAddr, QDF_MAC_ADDR_SIZE); @@ -1964,10 +1916,8 @@ void lim_handle_csa_offload_msg(tpAniSirGlobal mac_ctx, } csa_offload_ind = qdf_mem_malloc(sizeof(tSmeCsaOffloadInd)); - if (NULL == csa_offload_ind) { - pe_err("memalloc fail eWNI_SME_CSA_OFFLOAD_EVENT"); + if (!csa_offload_ind) goto err; - } session_entry = pe_find_session_by_bssid(mac_ctx, @@ -2280,10 +2230,8 @@ void lim_send_sme_max_assoc_exceeded_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMa tSmeMaxAssocInd *pSmeMaxAssocInd; pSmeMaxAssocInd = qdf_mem_malloc(sizeof(tSmeMaxAssocInd)); - if (NULL == pSmeMaxAssocInd) { - pe_err("Failed to allocate memory"); + if (!pSmeMaxAssocInd) return; - } qdf_mem_copy((uint8_t *) pSmeMaxAssocInd->peer_mac.bytes, (uint8_t *) peerMacAddr, QDF_MAC_ADDR_SIZE); pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED; @@ -2324,12 +2272,9 @@ lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac, enum phy_ch_width ch_width; uint8_t ch_center_freq_seg1; - pSmeSwithChnlParams = (tSwitchChannelParams *) - qdf_mem_malloc(sizeof(tSwitchChannelParams)); - if (NULL == pSmeSwithChnlParams) { - pe_err("AllocateMemory failed for pSmeSwithChnlParams"); + pSmeSwithChnlParams = qdf_mem_malloc(sizeof(tSwitchChannelParams)); + if (!pSmeSwithChnlParams) return; - } qdf_mem_copy(pSmeSwithChnlParams, pChnlParams, sizeof(tSwitchChannelParams)); @@ -2491,12 +2436,9 @@ lim_process_beacon_tx_success_ind(tpAniSirGlobal mac_ctx, uint16_t msgType, if (session->gLimOperatingMode.present) { /* Done with nss update, send response back to SME */ session->gLimOperatingMode.present = 0; - bcn_tx_comp_rsp = (struct sir_beacon_tx_complete_rsp *) - qdf_mem_malloc(sizeof(*bcn_tx_comp_rsp)); - if (NULL == bcn_tx_comp_rsp) { - pe_err("AllocateMemory failed for bcn_tx_comp_rsp"); + bcn_tx_comp_rsp = qdf_mem_malloc(sizeof(*bcn_tx_comp_rsp)); + if (!bcn_tx_comp_rsp) return; - } bcn_tx_comp_rsp->session_id = session->smeSessionId; bcn_tx_comp_rsp->tx_status = QDF_STATUS_SUCCESS; msg.type = eWNI_SME_NSS_UPDATE_RSP; diff --git a/core/mac/src/pe/lim/lim_session.c b/core/mac/src/pe/lim/lim_session.c index 9e5204575cbd..f508d70f7ac9 100644 --- a/core/mac/src/pe/lim/lim_session.c +++ b/core/mac/src/pe/lim/lim_session.c @@ -48,13 +48,10 @@ QDF_STATUS pe_allocate_dph_node_array_buffer(void) buf_size = SIR_MAX_SUPPORTED_BSS * (SIR_SAP_MAX_NUM_PEERS + 1) * sizeof(struct sDphHashNode); g_dph_node_array = qdf_mem_malloc(buf_size); - - if (!g_dph_node_array) { - pe_err("%s: Failed to allocate %d bytes", __func__, buf_size); + if (!g_dph_node_array) return QDF_STATUS_E_NOMEM; - } else { - return QDF_STATUS_SUCCESS; - } + + return QDF_STATUS_SUCCESS; } void pe_free_dph_node_array_buffer(void) @@ -363,11 +360,8 @@ static void pe_init_fils_info(tpPESession session) } session->fils_info = qdf_mem_malloc(sizeof(struct pe_fils_session)); fils_info = session->fils_info; - if (!fils_info) { - QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, - FL("fils info not found")); + if (!fils_info) return; - } fils_info->keyname_nai_data = NULL; fils_info->fils_erp_reauth_pkt = NULL; fils_info->fils_rrk = NULL; @@ -591,10 +585,8 @@ tpPESession pe_create_session(tpAniSirGlobal pMac, /* Allocate space for Station Table for this session. */ session_ptr->dph.dphHashTable.pHashTable = qdf_mem_malloc(sizeof(tpDphHashNode) * (numSta + 1)); - if (NULL == session_ptr->dph.dphHashTable.pHashTable) { - pe_err("memory allocate failed!"); + if (!session_ptr->dph.dphHashTable.pHashTable) return NULL; - } session_ptr->dph.dphHashTable.pDphNodeArray = pe_get_session_dph_node_array(i); @@ -603,10 +595,8 @@ tpPESession pe_create_session(tpAniSirGlobal pMac, session_ptr->gpLimPeerIdxpool = qdf_mem_malloc( sizeof(*(session_ptr->gpLimPeerIdxpool)) * lim_get_peer_idxpool_size(numSta, bssType)); - if (!session_ptr->gpLimPeerIdxpool) { - pe_err("memory allocate failed!"); + if (!session_ptr->gpLimPeerIdxpool) goto free_dp_hash_table; - } session_ptr->freePeerIdxHead = 0; session_ptr->freePeerIdxTail = 0; @@ -660,7 +650,6 @@ tpPESession pe_create_session(tpAniSirGlobal pMac, if ((NULL == session_ptr->pSchProbeRspTemplate) || (NULL == session_ptr->pSchBeaconFrameBegin) || (NULL == session_ptr->pSchBeaconFrameEnd)) { - pe_err("memory allocate failed!"); goto free_session_attrs; } } diff --git a/core/mac/src/pe/lim/lim_timer_utils.c b/core/mac/src/pe/lim/lim_timer_utils.c index bdfece57e7e4..da7294321513 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.c +++ b/core/mac/src/pe/lim/lim_timer_utils.c @@ -238,17 +238,14 @@ uint32_t lim_create_timers(tpAniSirGlobal pMac) pMac->lim.gLimPreAuthTimerTable.pTable = qdf_mem_malloc(cfgValue * sizeof(tLimPreAuthNode *)); - if (pMac->lim.gLimPreAuthTimerTable.pTable == NULL) { - pe_err("AllocateMemory failed!"); + if (!pMac->lim.gLimPreAuthTimerTable.pTable) goto err_timer; - } for (i = 0; i < cfgValue; i++) { pMac->lim.gLimPreAuthTimerTable.pTable[i] = qdf_mem_malloc(sizeof(tLimPreAuthNode)); if (pMac->lim.gLimPreAuthTimerTable.pTable[i] == NULL) { pMac->lim.gLimPreAuthTimerTable.numEntry = 0; - pe_err("AllocateMemory failed!"); goto err_timer; } } diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 8510acb9e7e7..208b2bc0dc82 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -2564,10 +2564,8 @@ void lim_switch_channel_cback(tpAniSirGlobal pMac, QDF_STATUS status, mmhMsg.type = eWNI_SME_SWITCH_CHL_IND; pSirSmeSwitchChInd = qdf_mem_malloc(sizeof(tSirSmeSwitchChannelInd)); - if (NULL == pSirSmeSwitchChInd) { - pe_err("Failed to allocate buffer for buffer descriptor"); + if (!pSirSmeSwitchChInd) return; - } pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_IND; pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd); @@ -4649,10 +4647,8 @@ void lim_register_hal_ind_call_back(tpAniSirGlobal pMac) tpHalIndCB pHalCB; pHalCB = qdf_mem_malloc(sizeof(tHalIndCB)); - if (NULL == pHalCB) { - pe_err("AllocateMemory() failed"); + if (!pHalCB) return; - } pHalCB->pHalIndCB = lim_process_hal_ind_messages; @@ -4718,10 +4714,8 @@ void lim_process_del_ts_ind(tpAniSirGlobal pMac, struct scheduler_msg *limMsg) } pDelTsReq = qdf_mem_malloc(sizeof(tSirDeltsReq)); - if (NULL == pDelTsReq) { - pe_err("AllocateMemory() failed"); + if (!pDelTsReq) goto error1; - } if (pSta->wmeEnabled) qdf_mem_copy(&(pDelTsReq->req.tspec), &(pTspecInfo->tspec), @@ -4748,10 +4742,8 @@ void lim_process_del_ts_ind(tpAniSirGlobal pMac, struct scheduler_msg *limMsg) /* prepare and send an sme indication to HDD */ pDelTsReqInfo = qdf_mem_malloc(sizeof(tSirDeltsReqInfo)); - if (NULL == pDelTsReqInfo) { - pe_err("AllocateMemory() failed"); + if (!pDelTsReqInfo) goto error3; - } if (pSta->wmeEnabled) qdf_mem_copy(&(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), @@ -4804,10 +4796,8 @@ lim_post_sm_state_update(tpAniSirGlobal pMac, /* Allocate for WMA_SET_MIMOPS_REQ */ pMIMO_PSParams = qdf_mem_malloc(sizeof(tSetMIMOPS)); - if (NULL == pMIMO_PSParams) { - pe_err(" AllocateMemory failed"); + if (!pMIMO_PSParams) return QDF_STATUS_E_NOMEM; - } pMIMO_PSParams->htMIMOPSState = state; pMIMO_PSParams->staIdx = staIdx; @@ -5060,10 +5050,8 @@ void lim_frame_transmission_control(tpAniSirGlobal pMac, tLimQuietTxMode type, nBytes = (uint8_t) HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation); pTxCtrlMsg = qdf_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes); - if (NULL == pTxCtrlMsg) { - pe_err("AllocateMemory() failed"); + if (!pTxCtrlMsg) return; - } status = __lim_fill_tx_control_params(pMac, pTxCtrlMsg, type, mode); if (status != QDF_STATUS_SUCCESS) { @@ -6335,10 +6323,8 @@ static QDF_STATUS lim_send_ie(tpAniSirGlobal mac_ctx, uint32_t sme_session_id, /* Allocate memory for the WMI request */ ie_msg = qdf_mem_malloc(sizeof(*ie_msg) + len); - if (!ie_msg) { - pe_err("Failed to allocate memory"); + if (!ie_msg) return QDF_STATUS_E_NOMEM; - } ie_msg->vdev_id = sme_session_id; ie_msg->ie_id = eid; @@ -6514,10 +6500,8 @@ QDF_STATUS lim_send_ext_cap_ie(tpAniSirGlobal mac_ctx, /* Allocate memory for the WMI request, and copy the parameter */ vdev_ie = qdf_mem_malloc(sizeof(*vdev_ie) + num_bytes); - if (!vdev_ie) { - pe_err("Failed to allocate memory"); + if (!vdev_ie) return QDF_STATUS_E_NOMEM; - } vdev_ie->vdev_id = session_id; vdev_ie->ie_id = DOT11F_EID_EXTCAP; @@ -6578,10 +6562,8 @@ QDF_STATUS lim_strip_ie(tpAniSirGlobal mac_ctx, } tempbuf = qdf_mem_malloc(left); - if (NULL == tempbuf) { - pe_err("Unable to allocate memory"); + if (!tempbuf) return QDF_STATUS_E_NOMEM; - } while (left >= 2) { elem_id = ptr[0]; @@ -7084,10 +7066,8 @@ void lim_send_set_dtim_period(tpAniSirGlobal mac_ctx, uint8_t dtim_period, return; } dtim_params = qdf_mem_malloc(sizeof(*dtim_params)); - if (!dtim_params) { - pe_err("Unable to allocate memory"); + if (!dtim_params) return; - } dtim_params->dtim_period = dtim_period; dtim_params->session_id = session->smeSessionId; msg.type = WMA_SET_DTIM_PERIOD; @@ -8035,10 +8015,8 @@ void lim_assoc_rej_add_to_rssi_based_reject_list(tpAniSirGlobal mac_ctx, QDF_STATUS status = QDF_STATUS_SUCCESS; entry = qdf_mem_malloc(sizeof(*entry)); - if (!entry) { - pe_err("malloc failed for bssid entry"); + if (!entry) return; - } pe_debug("%pM: assoc resp rssi %d, delta rssi %d retry delay %d sec and list size %d", bssid, rssi, rssi_assoc_rej->delta_rssi, @@ -8281,10 +8259,8 @@ void lim_send_sme_mgmt_frame_ind(tpAniSirGlobal mac_ctx, uint8_t frame_type, length = sizeof(tSirSmeMgmtFrameInd) + frame_len; sme_mgmt_frame = qdf_mem_malloc(length); - if (!sme_mgmt_frame) { - pe_err("AllocateMemory failed for eWNI_SME_LISTEN_RSP"); + if (!sme_mgmt_frame) return; - } if (qdf_is_macaddr_broadcast( (struct qdf_mac_addr *)(frame + 4)) && @@ -8392,10 +8368,8 @@ void lim_process_ap_ecsa_timeout(void *data) session->dfsIncludeChanWrapperIe = false; chan_switch_tx_rsp = qdf_mem_malloc(length); - if (!chan_switch_tx_rsp) { - pe_err("AllocateMemory failed for tSirSmeCSAIeTxCompleteRsp"); + if (!chan_switch_tx_rsp) return; - } chan_switch_tx_rsp->sessionId = session->smeSessionId; chan_switch_tx_rsp->chanSwIeTxStatus = QDF_STATUS_SUCCESS; diff --git a/core/mac/src/pe/nan/nan_datapath.c b/core/mac/src/pe/nan/nan_datapath.c index 04a4f32f502e..ab38d143c91e 100644 --- a/core/mac/src/pe/nan/nan_datapath.c +++ b/core/mac/src/pe/nan/nan_datapath.c @@ -196,10 +196,8 @@ static void lim_ndp_delete_peers(tpAniSirGlobal mac_ctx, bool found; deleted_peers = qdf_mem_malloc(num_peers * sizeof(*deleted_peers)); - if (!deleted_peers) { - pe_err("Memory allocation failed"); + if (!deleted_peers) return; - } for (i = 0; i < num_peers; i++) { pe_info("ndp_map[%d]: MAC: " MAC_ADDRESS_STR " num_active %d", @@ -471,7 +469,6 @@ static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx, new_peer_ind = qdf_mem_malloc(sizeof(*new_peer_ind)); if (!new_peer_ind) { - pe_err("Failed to allocate memory"); wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID); return QDF_STATUS_E_NOMEM; } diff --git a/core/mac/src/pe/rrm/rrm_api.c b/core/mac/src/pe/rrm/rrm_api.c index c96b40e7e24b..e15063c9ac83 100644 --- a/core/mac/src/pe/rrm/rrm_api.c +++ b/core/mac/src/pe/rrm/rrm_api.c @@ -145,11 +145,8 @@ rrm_send_set_max_tx_power_req(tpAniSirGlobal pMac, int8_t txPower, return QDF_STATUS_E_FAILURE; } pMaxTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); - if (NULL == pMaxTxParams) { - pe_err("Unable to allocate memory for pMaxTxParams"); + if (!pMaxTxParams) return QDF_STATUS_E_NOMEM; - - } /* Allocated memory for pMaxTxParams...will be freed in other module */ pMaxTxParams->power = txPower; qdf_mem_copy(pMaxTxParams->bssId.bytes, pSessionEntry->bssId, @@ -356,10 +353,8 @@ rrm_process_neighbor_report_response(tpAniSirGlobal pMac, /* Prepare the request to send to SME. */ pSmeNeighborRpt = qdf_mem_malloc(length); - if (NULL == pSmeNeighborRpt) { - pe_err("Unable to allocate memory"); + if (!pSmeNeighborRpt) return QDF_STATUS_E_NOMEM; - } /* Allocated memory for pSmeNeighborRpt...will be freed by other module */ @@ -579,10 +574,8 @@ rrm_process_beacon_report_req(tpAniSirGlobal pMac, qdf_mem_malloc(sizeof(uint8_t) * pBeaconReq->measurement_request.Beacon. RequestedInfo.num_requested_eids); - if (NULL == pCurrentReq->request.Beacon.reqIes.pElementIds) { - pe_err("Unable to allocate memory for request IEs buffer"); + if (!pCurrentReq->request.Beacon.reqIes.pElementIds) return eRRM_FAILURE; - } pCurrentReq->request.Beacon.reqIes.num = pBeaconReq->measurement_request.Beacon.RequestedInfo. num_requested_eids; @@ -603,12 +596,9 @@ rrm_process_beacon_report_req(tpAniSirGlobal pMac, } /* Prepare the request to send to SME. */ pSmeBcnReportReq = qdf_mem_malloc(sizeof(tSirBeaconReportReqInd)); - if (NULL == pSmeBcnReportReq) { - pe_err("Unable to allocate memory during Beacon Report Req Ind to SME"); + if (!pSmeBcnReportReq) return eRRM_FAILURE; - } - /* Allocated memory for pSmeBcnReportReq....will be freed by other modulea */ qdf_mem_copy(pSmeBcnReportReq->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr)); @@ -806,9 +796,7 @@ rrm_process_beacon_report_xmit(tpAniSirGlobal mac_ctx, report = qdf_mem_malloc(beacon_xmit_ind->numBssDesc * sizeof(*report)); - - if (NULL == report) { - pe_err("RRM Report is NULL, allocation failed"); + if (!report) { status = QDF_STATUS_E_NOMEM; goto end; } @@ -955,10 +943,8 @@ static void rrm_process_beacon_request_failure(tpAniSirGlobal pMac, tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; pReport = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport)); - if (NULL == pReport) { - pe_err("Unable to allocate memory during RRM Req processing"); + if (!pReport) return; - } pReport->token = pCurrentReq->token; pReport->type = SIR_MAC_RRM_BEACON_TYPE; @@ -1022,10 +1008,8 @@ QDF_STATUS rrm_process_beacon_req(tpAniSirGlobal mac_ctx, tSirMacAddr peer, */ *radiomes_report = qdf_mem_malloc(sizeof(*report) * (rrm_req->num_MeasurementRequest - index)); - if (NULL == *radiomes_report) { - pe_err("Unable to allocate memory during RRM Req processing"); + if (!*radiomes_report) return QDF_STATUS_E_NOMEM; - } pe_debug("rrm beacon type refused of %d report in beacon table", *num_report); } @@ -1038,8 +1022,7 @@ QDF_STATUS rrm_process_beacon_req(tpAniSirGlobal mac_ctx, tSirMacAddr peer, return QDF_STATUS_SUCCESS; } else { curr_req = qdf_mem_malloc(sizeof(*curr_req)); - if (NULL == curr_req) { - pe_err("Unable to allocate memory during RRM Req processing"); + if (!curr_req) { qdf_mem_free(*radiomes_report); return QDF_STATUS_E_NOMEM; } @@ -1085,10 +1068,8 @@ QDF_STATUS update_rrm_report(tpAniSirGlobal mac_ctx, */ report = qdf_mem_malloc(sizeof(*report) * (rrm_req->num_MeasurementRequest - index)); - if (NULL == report) { - pe_err("Unable to allocate memory during RRM Req processing"); + if (!report) return QDF_STATUS_E_NOMEM; - } pe_debug("rrm beacon type incapable of %d report", *num_report); } @@ -1127,10 +1108,8 @@ rrm_process_radio_measurement_request(tpAniSirGlobal mac_ctx, if (!rrm_req->num_MeasurementRequest) { report = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport)); - if (NULL == report) { - pe_err("Unable to allocate memory during RRM Req processing"); + if (!report) return QDF_STATUS_E_NOMEM; - } pe_err("No requestIes in the measurement request, sending incapable report"); report->incapable = 1; num_report = 1; @@ -1149,10 +1128,8 @@ rrm_process_radio_measurement_request(tpAniSirGlobal mac_ctx, * Not supporting repetitions. */ report = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport)); - if (NULL == report) { - pe_err("Unable to allocate memory during RRM Req processing"); + if (!report) return QDF_STATUS_E_NOMEM; - } report->incapable = 1; report->type = rrm_req->MeasurementRequest[0].measurement_type; num_report = 1; diff --git a/core/mac/src/pe/sch/sch_beacon_gen.c b/core/mac/src/pe/sch/sch_beacon_gen.c index 2b62b5ea149a..46106ad7fe6c 100644 --- a/core/mac/src/pe/sch/sch_beacon_gen.c +++ b/core/mac/src/pe/sch/sch_beacon_gen.c @@ -248,21 +248,17 @@ sch_set_fixed_beacon_fields(tpAniSirGlobal mac_ctx, tpPESession session) bool extcap_present = true, addnie_present = false; bcn_1 = qdf_mem_malloc(sizeof(tDot11fBeacon1)); - if (NULL == bcn_1) { - pe_err("Failed to allocate memory"); + if (!bcn_1) return QDF_STATUS_E_NOMEM; - } bcn_2 = qdf_mem_malloc(sizeof(tDot11fBeacon2)); - if (NULL == bcn_2) { - pe_err("Failed to allocate memory"); + if (!bcn_2) { qdf_mem_free(bcn_1); return QDF_STATUS_E_NOMEM; } wsc_prb_res = qdf_mem_malloc(sizeof(tDot11fIEWscProbeRes)); - if (NULL == wsc_prb_res) { - pe_err("Failed to allocate memory"); + if (!wsc_prb_res) { qdf_mem_free(bcn_1); qdf_mem_free(bcn_2); return QDF_STATUS_E_NOMEM; @@ -553,7 +549,6 @@ sch_set_fixed_beacon_fields(tpAniSirGlobal mac_ctx, tpPESession session) addn_ielen = session->addIeParams.probeRespBCNDataLen; addn_ie = qdf_mem_malloc(addn_ielen); if (!addn_ie) { - pe_err("addn_ie malloc failed"); qdf_mem_free(bcn_1); qdf_mem_free(bcn_2); qdf_mem_free(wsc_prb_res); diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index d5aa12fff055..855f949cc11c 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -1441,10 +1441,8 @@ QDF_STATUS lim_obss_send_detection_cfg(tpAniSirGlobal mac_ctx, || force) { struct scheduler_msg msg = {0}; req_param = qdf_mem_malloc(sizeof(*req_param)); - if (!req_param) { - pe_err("Failed to allocate memory"); + if (!req_param) return QDF_STATUS_E_NOMEM; - } qdf_mem_copy(&session->obss_offload_cfg, &obss_cfg, sizeof(obss_cfg)); req_param->vdev_id = session->smeSessionId; diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index 8af06f973be8..5c6dd345eb0d 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -2341,10 +2341,8 @@ QDF_STATUS sir_convert_probe_frame2_struct(tpAniSirGlobal pMac, qdf_mem_set((uint8_t *) pProbeResp, sizeof(tSirProbeRespBeacon), 0); pr = qdf_mem_malloc(sizeof(tDot11fProbeResponse)); - if (NULL == pr) { - pe_err("Failed to allocate memory"); + if (!pr) return QDF_STATUS_E_NOMEM; - } /* delegate to the framesc-generated code, */ status = dot11f_unpack_probe_response(pMac, pFrame, nFrame, pr, false); @@ -2617,10 +2615,8 @@ sir_convert_assoc_req_frame2_struct(tpAniSirGlobal pMac, uint32_t status; ar = qdf_mem_malloc(sizeof(tDot11fAssocRequest)); - if (NULL == ar) { - pe_err("Failed to allocate memory"); + if (!ar) return QDF_STATUS_E_NOMEM; - } /* Zero-init our [out] parameter, */ qdf_mem_set((uint8_t *) pAssocReq, sizeof(tSirAssocReq), 0); @@ -2917,10 +2913,8 @@ sir_convert_assoc_resp_frame2_struct(tpAniSirGlobal pMac, uint8_t cnt = 0; ar = qdf_mem_malloc(sizeof(*ar)); - if (!ar) { - pe_err("Assoc rsp mem alloc fails"); + if (!ar) return QDF_STATUS_E_FAILURE; - } /* decrypt the cipher text using AEAD decryption */ if (lim_is_fils_connection(session_entry)) { @@ -3165,10 +3159,8 @@ sir_convert_reassoc_req_frame2_struct(tpAniSirGlobal pMac, uint32_t status; ar = qdf_mem_malloc(sizeof(*ar)); - if (!ar) { - pe_err("mem alloc failed"); + if (!ar) return QDF_STATUS_E_NOMEM; - } /* Zero-init our [out] parameter, */ qdf_mem_set((uint8_t *) pAssocReq, sizeof(tSirAssocReq), 0); @@ -3353,10 +3345,8 @@ sir_beacon_ie_ese_bcn_report(tpAniSirGlobal pMac, qdf_mem_set((uint8_t *) &eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0); pBies = qdf_mem_malloc(sizeof(tDot11fBeaconIEs)); - if (NULL == pBies) { - pe_err("Failed to allocate memory"); + if (!pBies) return QDF_STATUS_E_NOMEM; - } qdf_mem_zero(pBies, sizeof(tDot11fBeaconIEs)); /* delegate to the framesc-generated code, */ status = dot11f_unpack_beacon_i_es(pMac, pPayload, nPayload, @@ -3437,8 +3427,7 @@ sir_beacon_ie_ese_bcn_report(tpAniSirGlobal pMac, } *outIeBuf = qdf_mem_malloc(numBytes); - if (NULL == *outIeBuf) { - pe_err("Memory Allocation failure"); + if (!*outIeBuf) { qdf_mem_free(pBies); return QDF_STATUS_E_NOMEM; } @@ -3648,10 +3637,8 @@ sir_parse_beacon_ie(tpAniSirGlobal pMac, qdf_mem_set((uint8_t *) pBeaconStruct, sizeof(tSirProbeRespBeacon), 0); pBies = qdf_mem_malloc(sizeof(tDot11fBeaconIEs)); - if (NULL == pBies) { - pe_err("Failed to allocate memory"); + if (!pBies) return QDF_STATUS_E_NOMEM; - } qdf_mem_zero(pBies, sizeof(tDot11fBeaconIEs)); /* delegate to the framesc-generated code, */ status = dot11f_unpack_beacon_i_es(pMac, pPayload, nPayload, @@ -3966,10 +3953,8 @@ sir_convert_beacon_frame2_struct(tpAniSirGlobal pMac, qdf_mem_set((uint8_t *) pBeaconStruct, sizeof(tSirProbeRespBeacon), 0); pBeacon = qdf_mem_malloc(sizeof(tDot11fBeacon)); - if (NULL == pBeacon) { - pe_err("Failed to allocate memory"); + if (!pBeacon) return QDF_STATUS_E_NOMEM; - } /* get the MAC address out of the BD, */ qdf_mem_copy(pBeaconStruct->bssid, pHdr->sa, 6);