diff --git a/core/mac/src/pe/lim/lim_admit_control.c b/core/mac/src/pe/lim/lim_admit_control.c index 8600a4897b..c39c02087d 100644 --- a/core/mac/src/pe/lim/lim_admit_control.c +++ b/core/mac/src/pe/lim/lim_admit_control.c @@ -211,7 +211,7 @@ lim_compute_mean_bw_used(struct mac_context *mac, tpDphHashNode pSta = dph_get_hash_entry(mac, pTspecInfo->assocId, &pe_session->dph.dphHashTable); - if (pSta == NULL) { + if (!pSta) { /* maybe we should delete the tspec?? */ pe_err("Tspec: %d assocId: %d dphNode not found", ctspec, pTspecInfo->assocId); @@ -361,7 +361,7 @@ static QDF_STATUS lim_admit_policy(struct mac_context *mac, /* delete the specified tspec */ static void lim_tspec_delete(struct mac_context *mac, tpLimTspecInfo pInfo) { - if (pInfo == NULL) + if (!pInfo) return; /* pierre */ pe_debug("tspec entry: %d delete tspec: %pK", pInfo->idx, pInfo); @@ -587,7 +587,7 @@ lim_validate_access_policy(struct mac_context *mac, tpDphHashNode pSta = dph_get_hash_entry(mac, assocId, &pe_session->dph.dphHashTable); - if ((pSta == NULL) || (!pSta->valid)) { + if ((!pSta) || (!pSta->valid)) { pe_err("invalid station address passed"); return QDF_STATUS_E_FAILURE; } @@ -681,7 +681,7 @@ QDF_STATUS lim_admit_control_add_ts(struct mac_context *mac, uint8_t *pAddr, return QDF_STATUS_E_FAILURE; } /* fill in a schedule if requested */ - if (pSch != NULL) { + if (pSch) { qdf_mem_zero((uint8_t *) pSch, sizeof(*pSch)); pSch->svcStartTime = pAddts->tspec.svcStartTime; pSch->svcInterval = svcInterval; @@ -736,13 +736,13 @@ lim_admit_control_delete_ts(struct mac_context *mac, { tpLimTspecInfo pTspecInfo = NULL; - if (pTsStatus != NULL) + if (pTsStatus) *pTsStatus = 0; if (lim_find_tspec (mac, assocId, pTsInfo, &mac->lim.tspecInfo[0], &pTspecInfo) == QDF_STATUS_SUCCESS) { - if (pTspecInfo != NULL) { + if (pTspecInfo) { pe_debug("Tspec entry: %d found", pTspecInfo->idx); *ptspecIdx = pTspecInfo->idx; @@ -824,7 +824,7 @@ lim_send_hal_msg_add_ts(struct mac_context *mac, struct pe_session *pe_session = pe_find_session_by_session_id(mac, sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Unable to get Session for session Id: %d", sessionId); return QDF_STATUS_E_FAILURE; @@ -904,7 +904,7 @@ lim_send_hal_msg_del_ts(struct mac_context *mac, qdf_mem_copy(&pDelTsParam->bssId, bssId, sizeof(tSirMacAddr)); pe_session = pe_find_session_by_session_id(mac, sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session does Not exist with given sessionId: %d", sessionId); goto err; @@ -971,7 +971,7 @@ void lim_process_hal_add_ts_rsp(struct mac_context *mac, /* from the sessionId in the Rsp Msg from HAL */ pe_session = pe_find_session_by_session_id(mac, pAddTsRspMsg->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session does Not exist with given sessionId: %d", pAddTsRspMsg->sessionId); lim_send_sme_addts_rsp(mac, rspReqd, eSIR_SME_ADDTS_RSP_FAILED, @@ -1002,7 +1002,7 @@ void lim_process_hal_add_ts_rsp(struct mac_context *mac, /* 090803: Pull the hash table from the session */ pSta = dph_lookup_assoc_id(mac, pAddTsRspMsg->staIdx, &assocId, &pe_session->dph.dphHashTable); - if (pSta != NULL) + if (pSta) lim_admit_control_delete_ts(mac, assocId, &pAddTsRspMsg->tspec.tsinfo, NULL, @@ -1018,7 +1018,7 @@ void lim_process_hal_add_ts_rsp(struct mac_context *mac, } end: - if (pAddTsRspMsg != NULL) + if (pAddTsRspMsg) qdf_mem_free(pAddTsRspMsg); return; } diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index e08a4f6c93..072b969f8f 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -461,7 +461,7 @@ void lim_cleanup(struct mac_context *mac) pe_deregister_mgmt_rx_frm_callback(mac); /* free up preAuth table */ - if (mac->lim.gLimPreAuthTimerTable.pTable != NULL) { + if (mac->lim.gLimPreAuthTimerTable.pTable) { for (i = 0; i < mac->lim.gLimPreAuthTimerTable.numEntry; i++) qdf_mem_free(mac->lim.gLimPreAuthTimerTable.pTable[i]); qdf_mem_free(mac->lim.gLimPreAuthTimerTable.pTable); @@ -469,23 +469,23 @@ void lim_cleanup(struct mac_context *mac) mac->lim.gLimPreAuthTimerTable.numEntry = 0; } - if (NULL != mac->lim.pDialogueTokenHead) { + if (mac->lim.pDialogueTokenHead) { lim_delete_dialogue_token_list(mac); } - if (NULL != mac->lim.pDialogueTokenTail) { + if (mac->lim.pDialogueTokenTail) { qdf_mem_free(mac->lim.pDialogueTokenTail); mac->lim.pDialogueTokenTail = NULL; } - if (mac->lim.gpLimMlmSetKeysReq != NULL) { + if (mac->lim.gpLimMlmSetKeysReq) { qdf_mem_zero(mac->lim.gpLimMlmSetKeysReq, sizeof(tLimMlmSetKeysReq)); qdf_mem_free(mac->lim.gpLimMlmSetKeysReq); mac->lim.gpLimMlmSetKeysReq = NULL; } - if (mac->lim.gpLimMlmAuthReq != NULL) { + if (mac->lim.gpLimMlmAuthReq) { qdf_mem_free(mac->lim.gpLimMlmAuthReq); mac->lim.gpLimMlmAuthReq = NULL; } @@ -919,8 +919,8 @@ static void pe_free_nested_messages(struct scheduler_msg *msg) -----------------------------------------------------------------*/ void pe_free_msg(struct mac_context *mac, struct scheduler_msg *pMsg) { - if (pMsg != NULL) { - if (NULL != pMsg->bodyptr) { + if (pMsg) { + if (pMsg->bodyptr) { if (SIR_BB_XPORT_MGMT_MSG == pMsg->type) { cds_pkt_return_packet((cds_pkt_t *) pMsg-> bodyptr); @@ -954,7 +954,7 @@ QDF_STATUS pe_mc_process_handler(struct scheduler_msg *msg) { struct mac_context *mac_ctx = cds_get_context(QDF_MODULE_ID_PE); - if (mac_ctx == NULL) + if (!mac_ctx) return QDF_STATUS_E_FAILURE; if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) @@ -1187,7 +1187,7 @@ static QDF_STATUS pe_handle_mgmt_frame(struct wlan_objmgr_psoc *psoc, int ret; mac = cds_get_context(QDF_MODULE_ID_PE); - if (NULL == mac) { + if (!mac) { /* cannot log a failure without a valid mac */ qdf_nbuf_free(buf); return QDF_STATUS_E_FAILURE; @@ -1842,11 +1842,11 @@ void lim_fill_join_rsp_ht_caps(struct pe_session *session, { struct ht_profile *ht_profile; - if (session == NULL) { + if (!session) { pe_err("Invalid Session"); return; } - if (join_rsp == NULL) { + if (!join_rsp) { pe_err("Invalid Join Response"); return; } @@ -2099,7 +2099,7 @@ pe_roam_synch_callback(struct mac_context *mac_ctx, } session_ptr = pe_find_session_by_sme_session_id(mac_ctx, roam_sync_ind_ptr->roamed_vdev_id); - if (session_ptr == NULL) { + if (!session_ptr) { pe_err("LFR3:Unable to find session"); return status; } @@ -2201,7 +2201,7 @@ pe_roam_synch_callback(struct mac_context *mac_ctx, lim_delete_tdls_peers(mac_ctx, session_ptr); curr_sta_ds = dph_lookup_hash_entry(mac_ctx, session_ptr->bssId, &aid, &session_ptr->dph.dphHashTable); - if (curr_sta_ds == NULL) { + if (!curr_sta_ds) { pe_err("LFR3:failed to lookup hash entry"); ft_session_ptr->bRoamSynchInProgress = false; return status; @@ -2216,7 +2216,7 @@ pe_roam_synch_callback(struct mac_context *mac_ctx, roam_sync_ind_ptr->bssid.bytes, DPH_STA_HASH_INDEX_PEER, &ft_session_ptr->dph.dphHashTable); - if (curr_sta_ds == NULL) { + if (!curr_sta_ds) { pe_err("LFR3:failed to add hash entry for %pM", add_bss_params->staContext.staMac); ft_session_ptr->bRoamSynchInProgress = false; @@ -2278,7 +2278,7 @@ pe_roam_synch_callback(struct mac_context *mac_ctx, } pe_debug("LFR3: Session RicLength: %d", ft_session_ptr->RICDataLen); - if (ft_session_ptr->ricData != NULL) { + if (ft_session_ptr->ricData) { roam_sync_ind_ptr->join_rsp->parsedRicRspLen = ft_session_ptr->RICDataLen; qdf_mem_copy(roam_sync_ind_ptr->join_rsp->frames, @@ -2290,7 +2290,7 @@ pe_roam_synch_callback(struct mac_context *mac_ctx, } #ifdef FEATURE_WLAN_ESE - if (ft_session_ptr->tspecIes != NULL) { + if (ft_session_ptr->tspecIes) { roam_sync_ind_ptr->join_rsp->tspecIeLen = ft_session_ptr->tspecLen; qdf_mem_copy(roam_sync_ind_ptr->join_rsp->frames + @@ -2487,7 +2487,7 @@ void lim_update_lost_link_info(struct mac_context *mac, struct pe_session *sessi struct sir_lost_link_info *lost_link_info; struct scheduler_msg mmh_msg = {0}; - if ((NULL == mac) || (NULL == session)) { + if ((!mac) || (!session)) { pe_err("parameter NULL"); return; } @@ -2527,7 +2527,7 @@ void lim_mon_init_session(struct mac_context *mac_ptr, mac_ptr->lim.maxStation, eSIR_MONITOR_MODE, msg->vdev_id); - if (psession_entry == NULL) { + if (!psession_entry) { pe_err("Monitor mode: Session Can not be created"); lim_print_mac_addr(mac_ptr, msg->bss_id.bytes, LOGE); return; diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index ee4a7c5ec1..f62af65aca 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -849,7 +849,7 @@ lim_send_del_sta_cnf(struct mac_context *mac, struct qdf_mac_addr sta_dsaddr, (uint32_t *) &mlmDisassocCnf); } - if (NULL != pe_session && !LIM_IS_AP_ROLE(pe_session)) { + if (pe_session && !LIM_IS_AP_ROLE(pe_session)) { pe_delete_session(mac, pe_session); pe_session = NULL; } @@ -929,7 +929,7 @@ lim_reject_association(struct mac_context *mac_ctx, tSirMacAddr peer_addr, sta_ds = dph_get_hash_entry(mac_ctx, sta_id, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("No STA context, yet rejecting Association"); return; } @@ -950,7 +950,7 @@ lim_reject_association(struct mac_context *mac_ctx, tSirMacAddr peer_addr, lim_send_assoc_rsp_mgmt_frame(mac_ctx, result_code, 0, peer_addr, sub_type, 0, session_entry); - if (session_entry->parsedAssocReq[sta_ds->assocId] != NULL) { + if (session_entry->parsedAssocReq[sta_ds->assocId]) { uint8_t *assoc_req_frame; assoc_req_frame = (uint8_t *)((tpSirAssocReq) (session_entry-> @@ -1039,7 +1039,7 @@ lim_decide_ap_protection_on_delete(struct mac_context *mac_ctx, enum band_info rf_band = BAND_UNKNOWN; uint32_t i; - if (NULL == sta_ds) + if (!sta_ds) return; lim_get_rf_band_new(mac_ctx, &rf_band, session_entry); @@ -1408,7 +1408,7 @@ QDF_STATUS lim_populate_vht_mcs_set(struct mac_context *mac_ctx, } } - if ((peer_vht_caps == NULL) || (!peer_vht_caps->present)) + if ((!peer_vht_caps) || (!peer_vht_caps->present)) return QDF_STATUS_SUCCESS; rates->vhtTxHighestDataRate = @@ -1467,7 +1467,7 @@ QDF_STATUS lim_populate_vht_mcs_set(struct mac_context *mac_ctx, vht_cap_info->enable2x2, nss, rates->vhtRxMCSMap, rates->vhtTxMCSMap); - if (NULL != session_entry) { + if (session_entry) { session_entry->supported_nss_1x1 = ((rates->vhtTxMCSMap & VHT_MCS_1x1) == VHT_MCS_1x1) ? true : false; @@ -1591,7 +1591,7 @@ QDF_STATUS lim_populate_own_rate_set(struct mac_context *mac_ctx, * else use the MCS set from local CFG. */ - if (supported_mcs_set != NULL) { + if (supported_mcs_set) { for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) rates->supportedMCSSet[i] &= supported_mcs_set[i]; @@ -1749,7 +1749,7 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac, /* if supported MCS Set of the peer is passed in, then do the * intersection, else use the MCS set from local CFG. */ - if (pSupportedMCSSet != NULL) { + if (pSupportedMCSSet) { for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) pRates->supportedMCSSet[i] &= pSupportedMCSSet[i]; @@ -2352,7 +2352,7 @@ lim_add_sta(struct mac_context *mac_ctx, add_sta_params->maxTxPower = session_entry->maxTxPower; - if (session_entry->parsedAssocReq != NULL) { + if (session_entry->parsedAssocReq) { uint16_t aid = sta_ds->assocId; /* Get a copy of the already parsed Assoc Request */ assoc_req = @@ -2940,13 +2940,13 @@ void lim_handle_cnf_wait_timeout(struct mac_context *mac, uint16_t staId) pe_session = pe_find_session_by_session_id(mac, mac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given sessionID"); return; } sta = dph_get_hash_entry(mac, staId, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { pe_err("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT"); return; } @@ -2999,7 +2999,7 @@ lim_delete_dph_hash_entry(struct mac_context *mac_ctx, tSirMacAddr sta_addr, beacon_params.paramChangeBitmap = 0; lim_deactivate_and_change_per_sta_id_timer(mac_ctx, eLIM_CNF_WAIT_TIMER, sta_id); - if (NULL == session_entry) { + if (!session_entry) { pe_err("NULL session_entry"); return; } @@ -3008,7 +3008,7 @@ lim_delete_dph_hash_entry(struct mac_context *mac_ctx, tSirMacAddr sta_addr, sta_ds = dph_lookup_hash_entry(mac_ctx, sta_addr, &aid, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("sta_ds is NULL"); return; } @@ -3345,7 +3345,7 @@ lim_del_bss(struct mac_context *mac, tpDphHashNode sta, uint16_t bssIdx, /* DPH was storing the AssocID in staID field, */ /* staID is actually assigned by HAL when AddSTA message is sent. */ - if (sta != NULL) { + if (sta) { pDelBssParams->bssIdx = sta->bssId; sta->valid = 0; sta->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE; @@ -3703,10 +3703,10 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp pAddBssParams->vhtCapable = 0; } if (pAddBssParams->vhtCapable) { - if (vht_oper != NULL) + if (vht_oper) lim_update_vht_oper_assoc_resp(mac, pAddBssParams, vht_oper, pe_session); - if (vht_caps != NULL) + if (vht_caps) lim_update_vhtcaps_assoc_resp(mac, pAddBssParams, vht_caps, pe_session); } @@ -3740,7 +3740,7 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp sta = dph_lookup_hash_entry(mac, pAddBssParams->staContext.bssId, &pAddBssParams->staContext.assocId, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { pe_err("Couldn't get assoc id for " "MAC ADDR: " MAC_ADDRESS_STR, MAC_ADDR_ARRAY( @@ -3792,16 +3792,16 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp is_vht_cap_in_vendor_ie = true; } - if ((vht_caps != NULL) && (vht_caps->suBeamFormerCap || + if ((vht_caps) && (vht_caps->suBeamFormerCap || vht_caps->muBeamformerCap) && pe_session->vht_config.su_beam_formee) sta_context->vhtTxBFCapable = 1; - if ((vht_caps != NULL) && vht_caps->muBeamformerCap && + if ((vht_caps) && vht_caps->muBeamformerCap && pe_session->vht_config.mu_beam_formee) sta_context->vhtTxMUBformeeCapable = 1; - if ((vht_caps != NULL) && vht_caps->suBeamformeeCap && + if ((vht_caps) && vht_caps->suBeamformeeCap && pe_session->vht_config.su_beam_former) sta_context->enable_su_tx_bformer = 1; @@ -3900,7 +3900,7 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp vht_caps = &pAssocRsp->vendor_vht_ie.VHTCaps; pe_debug("VHT Caps is in vendor Specific IE"); } - if (vht_caps != NULL && + if (vht_caps && (pe_session->txLdpcIniFeatureEnabled & 0x2)) { if (!is_vht_cap_in_vendor_ie) pAddBssParams->staContext.vhtLdpcCapable = @@ -3963,7 +3963,7 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp /* Update the rates */ sta = dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta != NULL) { + if (sta) { qdf_mem_copy(&pAddBssParams->staContext.supportedRates, &sta->supportedRates, sizeof(sta->supportedRates)); @@ -4243,7 +4243,7 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat } - if ((vht_oper != NULL) && + if ((vht_oper) && vht_oper->chanWidth && chanWidthSupp) { pAddBssParams->ch_center_freq_seg0 = @@ -4324,17 +4324,17 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat vht_caps = &pBeaconStruct-> vendor_vht_ie.VHTCaps; - if ((vht_caps != NULL) && (vht_caps->suBeamFormerCap || + if ((vht_caps) && (vht_caps->suBeamFormerCap || vht_caps->muBeamformerCap) && pe_session->vht_config.su_beam_formee) pAddBssParams->staContext.vhtTxBFCapable = 1; - if ((vht_caps != NULL) && vht_caps->muBeamformerCap && + if ((vht_caps) && vht_caps->muBeamformerCap && pe_session->vht_config.mu_beam_formee) pAddBssParams->staContext.vhtTxMUBformeeCapable = 1; - if ((vht_caps != NULL) && vht_caps->suBeamformeeCap && + if ((vht_caps) && vht_caps->suBeamformeeCap && pe_session->vht_config.su_beam_former) pAddBssParams->staContext.enable_su_tx_bformer = 1; @@ -4352,7 +4352,7 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat pAddBssParams->staContext.ch_width = (uint8_t) pBeaconStruct->HTInfo. recommendedTxWidthSet; - if ((vht_oper != NULL) && + if ((vht_oper) && pAddBssParams->staContext.vhtCapable && vht_oper->chanWidth) pAddBssParams->staContext.ch_width = @@ -4413,7 +4413,7 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat &pBeaconStruct->vendor_vht_ie.VHTCaps; pe_debug("VHT Caps are in vendor Specific IE"); } - if (vht_caps != NULL && + if (vht_caps && (pe_session->txLdpcIniFeatureEnabled & 0x2)) pAddBssParams->staContext.vhtLdpcCapable = (uint8_t) vht_caps->ldpcCodingCap; @@ -4572,7 +4572,7 @@ lim_prepare_and_send_del_sta_cnf(struct mac_context *mac, tpDphHashNode sta, struct qdf_mac_addr sta_dsaddr; tLimMlmStaContext mlmStaContext; - if (sta == NULL) { + if (!sta) { pe_err("sta is NULL"); return; } @@ -4666,7 +4666,7 @@ tLimPreAuthNode *lim_get_pre_auth_node_from_index(struct mac_context *mac, uint32_t authNodeIdx) { if ((authNodeIdx >= pAuthTable->numEntry) - || (pAuthTable->pTable == NULL)) { + || (!pAuthTable->pTable)) { pe_err("Invalid Auth Timer Index: %d NumEntry: %d", authNodeIdx, pAuthTable->numEntry); return NULL; diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index 210fdf992e..559eb30d76 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -69,7 +69,7 @@ void lim_ft_cleanup_all_ft_sessions(struct mac_context *mac) void lim_ft_cleanup(struct mac_context *mac, struct pe_session *pe_session) { - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); return; } @@ -80,7 +80,7 @@ void lim_ft_cleanup(struct mac_context *mac, struct pe_session *pe_session) return; } - if (NULL != pe_session->ftPEContext.pFTPreAuthReq) { + if (pe_session->ftPEContext.pFTPreAuthReq) { pe_debug("Freeing pFTPreAuthReq: %pK", pe_session->ftPEContext.pFTPreAuthReq); if (NULL != @@ -741,7 +741,7 @@ bool lim_process_ft_update_key(struct mac_context *mac, uint32_t *pMsgBuf) uint8_t sessionId; /* Sanity Check */ - if (mac == NULL || pMsgBuf == NULL) { + if (!mac || !pMsgBuf) { return false; } @@ -749,7 +749,7 @@ bool lim_process_ft_update_key(struct mac_context *mac, uint32_t *pMsgBuf) pe_session = pe_find_session_by_bssid(mac, pKeyInfo->bssid.bytes, &sessionId); - if (NULL == pe_session) { + if (!pe_session) { pe_err("%s: Unable to find session for the following bssid", __func__); lim_print_mac_addr(mac, pKeyInfo->bssid.bytes, LOGE); @@ -762,7 +762,7 @@ bool lim_process_ft_update_key(struct mac_context *mac, uint32_t *pMsgBuf) return false; } - if (NULL == pe_session->ftPEContext.pAddBssReq) { + if (!pe_session->ftPEContext.pAddBssReq) { /* AddBss Req is NULL, save the keys to configure them later. */ tpLimMlmSetKeysReq pMlmSetKeysReq = &pe_session->ftPEContext.PreAuthKeyInfo. @@ -782,7 +782,7 @@ bool lim_process_ft_update_key(struct mac_context *mac, uint32_t *pMsgBuf) pe_session->ftPEContext.PreAuthKeyInfo. extSetStaKeyParamValid = true; - if (pe_session->ftPEContext.pAddStaReq == NULL) { + if (!pe_session->ftPEContext.pAddStaReq) { pe_err("pAddStaReq is NULL"); lim_send_set_sta_key_req(mac, pMlmSetKeysReq, 0, 0, pe_session, false); @@ -869,15 +869,15 @@ void lim_process_ft_aggr_qos_rsp(struct mac_context *mac, pe_debug(" Received AGGR_QOS_RSP from HAL"); SET_LIM_PROCESS_DEFD_MESGS(mac, true); pAggrQosRspMsg = limMsg->bodyptr; - if (NULL == pAggrQosRspMsg) { + if (!pAggrQosRspMsg) { pe_err("NULL pAggrQosRspMsg"); return; } pe_session = pe_find_session_by_session_id(mac, pAggrQosRspMsg->sessionId); - if (NULL == pe_session) { + if (!pe_session) { pe_err("Cant find session entry for %s", __func__); - if (pAggrQosRspMsg != NULL) { + if (pAggrQosRspMsg) { qdf_mem_free(pAggrQosRspMsg); } return; @@ -901,7 +901,7 @@ void lim_process_ft_aggr_qos_rsp(struct mac_context *mac, pSta = dph_lookup_assoc_id(mac, addTsParam.staIdx, &assocId, &pe_session->dph.dphHashTable); - if (pSta != NULL) { + if (pSta) { lim_admit_control_delete_ts(mac, assocId, &addTsParam.tspec. tsinfo, NULL, @@ -912,7 +912,7 @@ void lim_process_ft_aggr_qos_rsp(struct mac_context *mac, } lim_ft_send_aggr_qos_rsp(mac, rspReqd, pAggrQosRspMsg, pe_session->smeSessionId); - if (pAggrQosRspMsg != NULL) { + if (pAggrQosRspMsg) { qdf_mem_free(pAggrQosRspMsg); } return; @@ -939,7 +939,7 @@ QDF_STATUS lim_process_ft_aggr_qos_req(struct mac_context *mac, pe_session = pe_find_session_by_bssid(mac, aggrQosReq->bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("psession Entry Null for sessionId: %d", aggrQosReq->sessionId); qdf_mem_free(pAggrAddTsParam); @@ -955,7 +955,7 @@ QDF_STATUS lim_process_ft_aggr_qos_req(struct mac_context *mac, pSta = dph_lookup_hash_entry(mac, aggrQosReq->bssid.bytes, &aid, &pe_session->dph.dphHashTable); - if (pSta == NULL) { + if (!pSta) { pe_err("Station context not found - ignoring AddTsRsp"); qdf_mem_free(pAggrAddTsParam); return QDF_STATUS_E_FAILURE; @@ -1078,7 +1078,7 @@ QDF_STATUS lim_process_ft_aggr_qos_req(struct mac_context *mac, /* Send the Aggr QoS response to SME */ lim_ft_send_aggr_qos_rsp(mac, true, pAggrAddTsParam, pe_session->smeSessionId); - if (pAggrAddTsParam != NULL) { + if (pAggrAddTsParam) { qdf_mem_free(pAggrAddTsParam); } } diff --git a/core/mac/src/pe/lim/lim_ft_preauth.c b/core/mac/src/pe/lim/lim_ft_preauth.c index 21a64c4e67..f3e265bede 100644 --- a/core/mac/src/pe/lim/lim_ft_preauth.c +++ b/core/mac/src/pe/lim/lim_ft_preauth.c @@ -131,7 +131,7 @@ int lim_process_ft_pre_auth_req(struct mac_context *mac_ctx, uint8_t session_id; tpSirFTPreAuthReq ft_pre_auth_req = (tSirFTPreAuthReq *) msg->bodyptr; - if (NULL == ft_pre_auth_req) { + if (!ft_pre_auth_req) { pe_err("tSirFTPreAuthReq is NULL"); return buf_consumed; } @@ -140,7 +140,7 @@ int lim_process_ft_pre_auth_req(struct mac_context *mac_ctx, session = pe_find_session_by_bssid(mac_ctx, ft_pre_auth_req->currbssId, &session_id); - if (session == NULL) { + if (!session) { pe_err("Unable to find session for the bssid" MAC_ADDRESS_STR, MAC_ADDR_ARRAY(ft_pre_auth_req->currbssId)); @@ -228,7 +228,7 @@ void lim_perform_ft_pre_auth(struct mac_context *mac, QDF_STATUS status, unsigned int session_id; eCsrAuthType auth_type; - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); return; } @@ -322,7 +322,7 @@ QDF_STATUS lim_ft_setup_auth_session(struct mac_context *mac, ft_session = pe_find_session_by_bssid(mac, pe_session->limReAssocbssId, &sessionId); - if (ft_session == NULL) { + if (!ft_session) { pe_err("No session found for bssid"); lim_print_mac_addr(mac, pe_session->limReAssocbssId, LOGE); return QDF_STATUS_E_FAILURE; @@ -358,8 +358,8 @@ QDF_STATUS lim_ft_setup_auth_session(struct mac_context *mac, static void lim_ft_process_pre_auth_result(struct mac_context *mac, struct pe_session *pe_session) { - if (NULL == pe_session || - NULL == pe_session->ftPEContext.pFTPreAuthReq) + if (!pe_session || + !pe_session->ftPEContext.pFTPreAuthReq) return; /* Nothing to be done if the session is not in STA mode */ @@ -421,7 +421,7 @@ void lim_handle_ft_pre_auth_rsp(struct mac_context *mac, QDF_STATUS status, * SME once we resume link */ pe_session->ftPEContext.saved_auth_rsp_length = 0; - if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE)) { + if ((auth_rsp) && (auth_rsp_length < MAX_FTIE_SIZE)) { qdf_mem_copy(pe_session->ftPEContext.saved_auth_rsp, auth_rsp, auth_rsp_length); pe_session->ftPEContext.saved_auth_rsp_length = @@ -521,7 +521,7 @@ void lim_process_ft_preauth_rsp_timeout(struct mac_context *mac_ctx) pe_err("FT Pre-Auth Time Out!!!!"); session = pe_find_session_by_session_id(mac_ctx, mac_ctx->lim.limTimers.gLimFTPreAuthRspTimer.sessionId); - if (NULL == session) { + if (!session) { pe_err("Session Does not exist for given sessionID"); return; } @@ -535,7 +535,7 @@ void lim_process_ft_preauth_rsp_timeout(struct mac_context *mac_ctx) /* Reset the flag to indicate preauth request session */ session->ftPEContext.ftPreAuthSession = false; - if (NULL == session->ftPEContext.pFTPreAuthReq) { + if (!session->ftPEContext.pFTPreAuthReq) { /* Auth Rsp might already be posted to SME and ftcleanup done */ pe_err("pFTPreAuthReq is NULL sessionId: %d", mac_ctx->lim.limTimers.gLimFTPreAuthRspTimer.sessionId); @@ -597,7 +597,7 @@ void lim_post_ft_pre_auth_rsp(struct mac_context *mac_ctx, ft_pre_auth_rsp = qdf_mem_malloc(rsp_len); if (!ft_pre_auth_rsp) { - QDF_ASSERT(ft_pre_auth_rsp != NULL); + QDF_ASSERT(ft_pre_auth_rsp); return; } @@ -622,7 +622,7 @@ void lim_post_ft_pre_auth_rsp(struct mac_context *mac_ctx, /* Attach the auth response now back to SME */ ft_pre_auth_rsp->ft_ies_length = 0; - if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE)) { + if ((auth_rsp) && (auth_rsp_length < MAX_FTIE_SIZE)) { /* Only 11r assoc has FT IEs */ qdf_mem_copy(ft_pre_auth_rsp->ft_ies, auth_rsp, auth_rsp_length); @@ -673,7 +673,7 @@ QDF_STATUS lim_send_preauth_scan_offload(struct mac_context *mac_ctx, uint8_t session_id; QDF_STATUS status = QDF_STATUS_SUCCESS; - if (session_entry == NULL) { + if (!session_entry) { QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, FL("Session entry is NULL")); return QDF_STATUS_E_FAILURE; @@ -690,7 +690,7 @@ QDF_STATUS lim_send_preauth_scan_offload(struct mac_context *mac_ctx, vdev = wlan_objmgr_get_vdev_by_id_from_pdev(mac_ctx->pdev, session_id, WLAN_LEGACY_MAC_ID); - if (vdev == NULL) { + if (!vdev) { QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, FL("vdev object is NULL")); qdf_mem_free(req); @@ -772,7 +772,7 @@ void lim_preauth_scan_event_handler(struct mac_context *mac_ctx, session_id); } - if (session_entry == NULL) { + if (!session_entry) { pe_err("SmeSessionId:%d PeSessionId:%d does not exist", session_id, mac_ctx->lim.limTimers.gLimFTPreAuthRspTimer.sessionId); 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 a5a8bf15a2..4fbf344054 100644 --- a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c +++ b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c @@ -58,7 +58,7 @@ static tLimIbssPeerNode *ibss_peer_find(struct mac_context *mac, { tLimIbssPeerNode *pTempNode = mac->lim.gLimIbssPeerList; - while (pTempNode != NULL) { + while (pTempNode) { if (!qdf_mem_cmp((uint8_t *) macAddr, (uint8_t *) &pTempNode->peerMacAddr, sizeof(tSirMacAddr))) @@ -102,7 +102,7 @@ ibss_peer_add(struct mac_context *mac, tLimIbssPeerNode *pPeerNode) tLimIbssPeerNode *pTemp, *pPrev; pTemp = pPrev = mac->lim.gLimIbssPeerList; - while (pTemp->next != NULL) { + while (pTemp->next) { pPrev = pTemp; pTemp = pTemp->next; } @@ -226,7 +226,7 @@ ibss_sta_caps_update(struct mac_context *mac, /* if the peer node exists, update its qos capabilities */ sta = dph_lookup_hash_entry(mac, pPeerNode->peerMacAddr, &peerIdx, &pe_session->dph.dphHashTable); - if (sta == NULL) + if (!sta) return; /* Update HT Capabilities */ @@ -464,7 +464,7 @@ ibss_dph_entry_add(struct mac_context *mac, sta = dph_lookup_hash_entry(mac, peerAddr, &peerIdx, &pe_session->dph.dphHashTable); - if (sta != NULL) { + if (sta) { /* Trying to add context for already existing STA in IBSS */ pe_err("STA exists already"); lim_print_mac_addr(mac, peerAddr, LOGE); @@ -490,7 +490,7 @@ ibss_dph_entry_add(struct mac_context *mac, sta = dph_add_hash_entry(mac, peerAddr, peerIdx, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { /* Could not add hash table entry */ pe_err("could not add hash entry at DPH for peerIdx/aid: %d MACaddr:", peerIdx); @@ -513,8 +513,8 @@ ibss_status_chg_notify(struct mac_context *mac, tSirMacAddr peerAddr, uint16_t bcnLen = 0; peerNode = ibss_peer_find(mac, peerAddr); - if (peerNode != NULL) { - if (peerNode->beacon == NULL) + if (peerNode) { + if (!peerNode->beacon) peerNode->beaconLen = 0; beacon = peerNode->beacon; bcnLen = peerNode->beaconLen; @@ -525,7 +525,7 @@ ibss_status_chg_notify(struct mac_context *mac, tSirMacAddr peerAddr, lim_send_sme_ibss_peer_ind(mac, peerAddr, staIndex, beacon, bcnLen, status, sessionId); - if (beacon != NULL) { + if (beacon) { qdf_mem_free(beacon); } } @@ -539,7 +539,7 @@ void ibss_bss_add(struct mac_context *mac, struct pe_session *pe_session) qdf_size_t num_ext_rates = 0; QDF_STATUS status; - if ((pHdr == NULL) || (pBeacon == NULL)) { + if ((!pHdr) || (!pBeacon)) { pe_err("Unable to add BSS (no cached BSS info)"); return; } @@ -703,7 +703,7 @@ void lim_ibss_delete_all_peers(struct mac_context *mac, pCurrNode = pTempNode = mac->lim.gLimIbssPeerList; - while (pCurrNode != NULL) { + while (pCurrNode) { if (!mac->lim.gLimNumIbssPeers) { pe_err("Number of peers in the list is zero and node present"); return; @@ -878,7 +878,7 @@ lim_ibss_decide_protection(struct mac_context *mac, tpDphHashNode sta, pBeaconParams->paramChangeBitmap = 0; - if (NULL == sta) { + if (!sta) { pe_err("sta is NULL"); return; } @@ -976,7 +976,7 @@ lim_ibss_sta_add(struct mac_context *mac, void *pBody, struct pe_session *pe_ses lim_print_mac_addr(mac, *pPeerAddr, LOGD); pPeerNode = ibss_peer_find(mac, *pPeerAddr); - if (NULL != pPeerNode) { + if (pPeerNode) { retCode = ibss_dph_entry_add(mac, *pPeerAddr, &sta, pe_session); @@ -1053,7 +1053,7 @@ lim_ibss_search_and_delete_peer(struct mac_context *mac_ctx, MAC_ADDR_ARRAY(mac_addr)); /** Compare Peer */ - while (NULL != temp_node) { + while (temp_node) { temp_next_node = temp_node->next; /* Delete the STA with MAC address */ @@ -1206,7 +1206,7 @@ lim_ibss_add_sta_rsp(struct mac_context *mac, void *msg, struct pe_session *pe_s tpAddStaParams pAddStaParams = (tpAddStaParams) msg; SET_LIM_PROCESS_DEFD_MESGS(mac, true); - if (pAddStaParams == NULL) { + if (!pAddStaParams) { pe_err("IBSS: ADD_STA_RSP with no body!"); return QDF_STATUS_E_FAILURE; } @@ -1214,7 +1214,7 @@ lim_ibss_add_sta_rsp(struct mac_context *mac, void *msg, struct pe_session *pe_s sta = dph_lookup_hash_entry(mac, pAddStaParams->staMac, &peerIdx, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { pe_err("IBSS: ADD_STA_RSP for unknown MAC addr: "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pAddStaParams->staMac)); qdf_mem_free(pAddStaParams); @@ -1255,7 +1255,7 @@ void lim_ibss_del_bss_rsp_when_coalescing(struct mac_context *mac, void *msg, pe_debug("IBSS: DEL_BSS_RSP Rcvd during coalescing!"); - if (pDelBss == NULL) { + if (!pDelBss) { pe_err("IBSS: DEL_BSS_RSP(coalesce) with no body!"); goto end; } @@ -1271,7 +1271,7 @@ void lim_ibss_del_bss_rsp_when_coalescing(struct mac_context *mac, void *msg, /* add the new bss */ ibss_bss_add(mac, pe_session); end: - if (pDelBss != NULL) + if (pDelBss) qdf_mem_free(pDelBss); } @@ -1284,7 +1284,7 @@ void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac, void *msg, tpSirMacMgmtHdr pHdr = mac->lim.ibss_info.mac_hdr; tpSchBeaconStruct pBeacon = mac->lim.ibss_info.beacon; - if ((pHdr == NULL) || (pBeacon == NULL)) { + if ((!pHdr) || (!pBeacon)) { pe_err("Unable to handle AddBssRspWhenCoalescing (no cached BSS info)"); goto end; } @@ -1319,14 +1319,14 @@ void lim_ibss_del_bss_rsp(struct mac_context *mac, void *msg, struct pe_session tSirMacAddr nullBssid = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; SET_LIM_PROCESS_DEFD_MESGS(mac, true); - if (pDelBss == NULL) { + if (!pDelBss) { pe_err("IBSS: DEL_BSS_RSP with no body!"); rc = eSIR_SME_REFUSED; goto end; } pe_session = pe_find_session_by_session_id(mac, pDelBss->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given sessionID"); goto end; } @@ -1378,10 +1378,10 @@ void lim_ibss_del_bss_rsp(struct mac_context *mac, void *msg, struct pe_session cfg_default(CFG_SHORT_SLOT_TIME_ENABLED); end: - if (pDelBss != NULL) + if (pDelBss) qdf_mem_free(pDelBss); /* Delete PE session once BSS is deleted */ - if (NULL != pe_session) { + if (pe_session) { lim_send_sme_rsp(mac, eWNI_SME_STOP_BSS_RSP, rc, pe_session->smeSessionId); pe_delete_session(mac, pe_session); @@ -1466,7 +1466,7 @@ lim_ibss_coalesce(struct mac_context *mac, * let the peer coalesce when we receive next beacon from the peer */ pPeerNode = ibss_peer_find(mac, pHdr->sa); - if (NULL != pPeerNode) { + if (pPeerNode) { lim_ibss_delete_peer(mac, pe_session, pHdr->sa); pe_warn("Peer attempting to reconnect before HB timeout, deleted"); @@ -1497,7 +1497,7 @@ lim_ibss_coalesce(struct mac_context *mac, /* STA in IBSS mode and SSID matches with ours */ pPeerNode = ibss_peer_find(mac, pHdr->sa); - if (pPeerNode == NULL) { + if (!pPeerNode) { /* Peer not in the list - Collect BSS description & add to the list */ uint32_t frameLen; QDF_STATUS retCode; @@ -1541,7 +1541,7 @@ lim_ibss_coalesce(struct mac_context *mac, sta = dph_lookup_hash_entry(mac, pPeerNode->peerMacAddr, &peerIdx, &pe_session->dph.dphHashTable); - if (sta != NULL) { + if (sta) { /* / DPH node already exists for the peer */ pe_warn("DPH Node present for just learned peer"); lim_print_mac_addr(mac, pPeerNode->peerMacAddr, LOGD); @@ -1626,7 +1626,7 @@ void lim_ibss_heart_beat_handle(struct mac_context *mac_ctx, struct pe_session * threshold = (mac_ctx->lim.gLimNumIbssPeers / 4) + 1; /* Monitor the HeartBeat with the Individual PEERS in the IBSS */ - while (tempnode != NULL) { + while (tempnode) { temp_next = tempnode->next; if (tempnode->beaconHBCount) { /* There was a beacon for this peer during heart beat */ @@ -1738,7 +1738,7 @@ void lim_ibss_decide_protection_on_delete(struct mac_context *mac_ctx, enum band_info rfband = BAND_UNKNOWN; uint32_t i; - if (NULL == stads) + if (!stads) return; lim_get_rf_band_new(mac_ctx, &rfband, session); diff --git a/core/mac/src/pe/lim/lim_link_monitoring_algo.c b/core/mac/src/pe/lim/lim_link_monitoring_algo.c index 2ef43d0dc3..d330c87f29 100644 --- a/core/mac/src/pe/lim/lim_link_monitoring_algo.c +++ b/core/mac/src/pe/lim/lim_link_monitoring_algo.c @@ -199,12 +199,12 @@ void lim_delete_sta_context(struct mac_context *mac_ctx, struct pe_session *session_entry; tpDphHashNode sta_ds; - if (NULL == msg) { + if (!msg) { pe_err("Invalid body pointer in message"); return; } session_entry = pe_find_session_by_sme_session_id(mac_ctx, msg->vdev_id); - if (NULL == session_entry) { + if (!session_entry) { pe_err("session not found for given sme session"); qdf_mem_free(msg); return; @@ -230,7 +230,7 @@ void lim_delete_sta_context(struct mac_context *mac_ctx, sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); - if (NULL == sta_ds) { + if (!sta_ds) { pe_err("Dph entry not found"); qdf_mem_free(msg); return; @@ -362,7 +362,7 @@ lim_tear_down_link_with_ap(struct mac_context *mac, uint8_t sessionId, struct pe_session *pe_session; pe_session = pe_find_session_by_session_id(mac, sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given sessionID"); return; } @@ -382,7 +382,7 @@ lim_tear_down_link_with_ap(struct mac_context *mac, uint8_t sessionId, dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta != NULL) { + if (sta) { tLimMlmDeauthInd mlmDeauthInd; if ((sta->mlmStaContext.disassocReason == @@ -517,7 +517,7 @@ void lim_handle_heart_beat_failure(struct mac_context *mac_ctx, */ pe_debug("HB missed from AP. Sending Probe Req"); /* for searching AP, we don't include any more IE */ - if (session->pLimJoinReq != NULL) { + if (session->pLimJoinReq) { scan_ie = &session->pLimJoinReq->addIEScan; lim_send_probe_req_mgmt_frame(mac_ctx, &session->ssId, @@ -572,14 +572,14 @@ void lim_rx_invalid_peer_process(struct mac_context *mac_ctx, uint16_t reason_code = eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON; - if (NULL == msg) { + if (!msg) { pe_err("Invalid body pointer in message"); return; } session_entry = pe_find_session_by_sme_session_id(mac_ctx, msg->vdev_id); - if (NULL == session_entry) { + if (!session_entry) { pe_err_rl("session not found for given sme session"); qdf_mem_free(msg); return; 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 eadaa6ac88..8ff0644ac7 100644 --- a/core/mac/src/pe/lim/lim_process_action_frame.c +++ b/core/mac/src/pe/lim/lim_process_action_frame.c @@ -76,7 +76,7 @@ void lim_stop_tx_and_switch_channel(struct mac_context *mac, uint8_t sessionId) pe_session = pe_find_session_by_session_id(mac, sessionId); - if (NULL == pe_session) { + if (!pe_session) { pe_err("Session: %d not active", sessionId); return; } @@ -471,7 +471,7 @@ static void __lim_process_operating_mode_action_frame(struct mac_context *mac_ct sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid, &session->dph.dphHashTable); - if (sta_ptr == NULL) { + if (!sta_ptr) { pe_err("Station context not found"); goto end; } @@ -705,7 +705,7 @@ static void __lim_process_add_ts_rsp(struct mac_context *mac_ctx, sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid, &session->dph.dphHashTable); - if (sta_ptr == NULL) { + if (!sta_ptr) { pe_err("Station context not found - ignoring AddTsRsp"); return; } @@ -833,7 +833,7 @@ static void __lim_process_add_ts_rsp(struct mac_context *mac_ctx, session); sta_ds_ptr = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session->dph.dphHashTable); - if (sta_ds_ptr != NULL) + if (sta_ds_ptr) lim_send_edca_params(mac_ctx, session->gLimEdcaParamsActive, sta_ds_ptr->bssId, false); else @@ -933,7 +933,7 @@ static void __lim_process_del_ts_req(struct mac_context *mac_ctx, sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid, &session->dph.dphHashTable); - if (sta_ptr == NULL) { + if (!sta_ptr) { pe_err("Station context not found - ignoring DelTs"); return; } @@ -1034,7 +1034,7 @@ static void __lim_process_del_ts_req(struct mac_context *mac_ctx, session); sta_ds_ptr = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session->dph.dphHashTable); - if (sta_ds_ptr != NULL) + if (sta_ds_ptr) lim_send_edca_params(mac_ctx, session->gLimEdcaParamsActive, sta_ds_ptr->bssId, false); else @@ -1212,7 +1212,7 @@ __lim_process_sm_power_save_update(struct mac_context *mac, uint8_t *pRxPacketIn pSta = dph_lookup_hash_entry(mac, pHdr->sa, &aid, &pe_session->dph.dphHashTable); - if (pSta == NULL) { + if (!pSta) { pe_err("STA context not found - ignoring UpdateSM PSave Mode from"); lim_print_mac_addr(mac, pHdr->sa, LOGE); return; @@ -1278,7 +1278,7 @@ __lim_process_radio_measure_request(struct mac_context *mac, uint8_t *pRxPacketI pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); - if (pe_session == NULL) { + if (!pe_session) { return; } @@ -1338,7 +1338,7 @@ __lim_process_link_measurement_req(struct mac_context *mac, uint8_t *pRxPacketIn pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); - if (pe_session == NULL) { + if (!pe_session) { return QDF_STATUS_E_FAILURE; } @@ -1381,7 +1381,7 @@ __lim_process_neighbor_report(struct mac_context *mac, uint8_t *pRxPacketInfo, if (!pFrm) return; - if (pe_session == NULL) { + if (!pe_session) { qdf_mem_free(pFrm); return; } @@ -1539,7 +1539,7 @@ static void __lim_process_sa_query_response_action_frame(struct mac_context *mac pSta = dph_lookup_hash_entry(mac, pHdr->sa, &aid, &pe_session->dph.dphHashTable); - if (NULL == pSta) + if (!pSta) return; pe_debug("SA Query Response source addr: %0x:%0x:%0x:%0x:%0x:%0x", @@ -1605,7 +1605,7 @@ lim_drop_unprotected_action_frame(struct mac_context *mac, struct pe_session *pe sta = dph_lookup_hash_entry(mac, pHdr->sa, &aid, &pe_session->dph.dphHashTable); - if (sta != NULL) + if (sta) if (sta->rmfEnabled) rmfConnection = true; } else if (pe_session->limRmfEnabled) 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 dc7f71c54b..11eebc2b85 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 @@ -515,7 +515,7 @@ static bool lim_chk_11ac_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, if (LIM_IS_AP_ROLE(session) && (session->dot11mode == MLME_DOT11_MODE_11AC_ONLY) && - ((vht_caps == NULL) || ((vht_caps != NULL) && (!vht_caps->present)))) { + ((!vht_caps) || ((vht_caps) && (!vht_caps->present)))) { lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, 1, hdr->sa, sub_type, 0, session); @@ -1080,7 +1080,7 @@ static bool lim_chk_n_process_wpa_rsn_ie(struct mac_context *mac_ctx, assoc_req->addIEPresent, assoc_req->addIE.length); /* when wps_ie is present, RSN/WPA IE is ignored */ - if (wps_ie == NULL) { + if (!wps_ie) { /* check whether RSN IE is present */ if (LIM_IS_AP_ROLE(session) && session->pLimStartBssReq->privacy && @@ -1131,7 +1131,7 @@ static bool lim_process_assoc_req_no_sta_ctx(struct mac_context *mac_ctx, return false; } /* Check if STA is pre-authenticated. */ - if ((sta_pre_auth_ctx == NULL) || (sta_pre_auth_ctx && + if ((!sta_pre_auth_ctx) || (sta_pre_auth_ctx && (sta_pre_auth_ctx->mlmState != eLIM_MLM_AUTHENTICATED_STATE))) { /* * STA is not pre-authenticated yet requesting Re/Association @@ -1411,9 +1411,9 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, * check here if the parsedAssocReq already pointing to the assoc_req * and free it before assigning this new assoc_req */ - if (session->parsedAssocReq != NULL) { + if (session->parsedAssocReq) { tmp_assoc_req = session->parsedAssocReq[sta_ds->assocId]; - if (tmp_assoc_req != NULL) { + if (tmp_assoc_req) { if (tmp_assoc_req->assocReqFrame) { qdf_mem_free(tmp_assoc_req->assocReqFrame); tmp_assoc_req->assocReqFrame = NULL; @@ -1428,7 +1428,7 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, } sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present; - if ((vht_caps != NULL) && vht_caps->present) + if ((vht_caps) && vht_caps->present) sta_ds->mlmStaContext.vhtCapability = vht_caps->present; else sta_ds->mlmStaContext.vhtCapability = false; @@ -1520,7 +1520,7 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, (uint8_t) (ch_width ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ); - } else if ((vht_caps != NULL) && vht_caps->present) { + } else if ((vht_caps) && vht_caps->present) { /* * Check if STA has enabled it's channel bonding mode. * If channel bonding mode is enabled, we decide based @@ -1550,7 +1550,7 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, (uint8_t) assoc_req->HTCaps.advCodingCap; } - if ((vht_caps != NULL) && vht_caps->present && + if ((vht_caps) && vht_caps->present && assoc_req->wmeInfoPresent) { sta_ds->vhtLdpcCapable = (uint8_t) vht_caps->ldpcCodingCap; @@ -1839,7 +1839,7 @@ void lim_process_assoc_cleanup(struct mac_context *mac_ctx, { tpSirAssocReq tmp_assoc_req; - if (assoc_req != NULL) { + if (assoc_req) { if (assoc_req->assocReqFrame) { qdf_mem_free(assoc_req->assocReqFrame); assoc_req->assocReqFrame = NULL; @@ -1853,12 +1853,12 @@ void lim_process_assoc_cleanup(struct mac_context *mac_ctx, } /* If it is not duplicate Assoc request then only make to Null */ - if ((sta_ds != NULL) && + if ((sta_ds) && (sta_ds->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE)) { - if (session->parsedAssocReq != NULL) { + if (session->parsedAssocReq) { tmp_assoc_req = session->parsedAssocReq[sta_ds->assocId]; - if (tmp_assoc_req != NULL) { + if (tmp_assoc_req) { if (tmp_assoc_req->assocReqFrame) { qdf_mem_free( tmp_assoc_req->assocReqFrame); @@ -2110,7 +2110,7 @@ void lim_process_assoc_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_in */ sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, &assoc_id, &session->dph.dphHashTable); - if (NULL != sta_ds) { + if (sta_ds) { if (hdr->fc.retry > 0) { pe_err("STA is initiating Assoc Req after ACK lost. Do not process sessionid: %d sys sub_type=%d for role=%d from: " MAC_ADDRESS_STR, session->peSessionId, @@ -2337,7 +2337,7 @@ static void lim_fill_assoc_ind_wapi_info(struct mac_context *mac_ctx, tpSirAssocReq assoc_req, tpLimMlmAssocInd assoc_ind, const uint8_t *wpsie) { - if (assoc_req->wapiPresent && (NULL == wpsie)) { + if (assoc_req->wapiPresent && (!wpsie)) { pe_debug("Received WAPI IE length in Assoc Req is %d", assoc_req->wapi.length); assoc_ind->wapiIE.wapiIEdata[0] = SIR_MAC_WAPI_EID; @@ -2563,7 +2563,7 @@ void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, assoc_req->addIE.addIEdata, assoc_req->addIE.length); } - if (assoc_req->rsnPresent && (NULL == wpsie)) { + if (assoc_req->rsnPresent && (!wpsie)) { pe_debug("Assoc Req RSN IE len: %d", assoc_req->rsn.length); assoc_ind->rsnIE.length = 2 + assoc_req->rsn.length; @@ -2589,7 +2589,7 @@ void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, } /* This check is to avoid extra Sec IEs present incase of WPS */ - if (assoc_req->wpaPresent && (NULL == wpsie)) { + if (assoc_req->wpaPresent && (!wpsie)) { rsn_len = assoc_ind->rsnIE.length; if ((rsn_len + assoc_req->wpa.length) >= WLAN_MAX_IE_LEN) { 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 b7d9960247..88d2c1ce7e 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 @@ -160,7 +160,7 @@ void lim_update_assoc_sta_datas(struct mac_context *mac_ctx, vht_caps = &assoc_rsp->vendor_vht_ie.VHTCaps; if (IS_DOT11_MODE_VHT(session_entry->dot11mode)) { - if ((vht_caps != NULL) && vht_caps->present) { + if ((vht_caps) && vht_caps->present) { sta_ds->mlmStaContext.vhtCapability = vht_caps->present; /* @@ -285,7 +285,7 @@ void lim_update_assoc_sta_datas(struct mac_context *mac_ctx, static void lim_update_ric_data(struct mac_context *mac_ctx, struct pe_session *session_entry, tpSirAssocRsp assoc_rsp) { - if (session_entry->ricData != NULL) { + if (session_entry->ricData) { qdf_mem_free(session_entry->ricData); session_entry->ricData = NULL; session_entry->RICDataLen = 0; @@ -328,7 +328,7 @@ static void lim_update_ric_data(struct mac_context *mac_ctx, static void lim_update_ese_tspec(struct mac_context *mac_ctx, struct pe_session *session_entry, tpSirAssocRsp assoc_rsp) { - if (session_entry->tspecIes != NULL) { + if (session_entry->tspecIes) { qdf_mem_free(session_entry->tspecIes); session_entry->tspecIes = NULL; session_entry->tspecLen = 0; @@ -456,7 +456,7 @@ static void lim_update_stads_ext_cap(struct mac_context *mac_ctx, static void lim_stop_reassoc_retry_timer(struct mac_context *mac_ctx) { mac_ctx->lim.reAssocRetryAttempt = 0; - if ((NULL != mac_ctx->lim.pe_session) + if ((mac_ctx->lim.pe_session) && (NULL != mac_ctx->lim.pe_session->pLimMlmReassocRetryReq)) { qdf_mem_free( @@ -508,7 +508,7 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, assoc_cnf.resultCode = eSIR_SME_SUCCESS; /* Update PE session Id */ assoc_cnf.sessionId = session_entry->peSessionId; - if (hdr == NULL) { + if (!hdr) { pe_err("LFR3: Reassoc response packet header is NULL"); return; } @@ -622,7 +622,7 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, } assoc_cnf.protStatusCode = assoc_rsp->statusCode; - if (session_entry->assocRsp != NULL) { + if (session_entry->assocRsp) { pe_warn("session_entry->assocRsp is not NULL freeing it and setting NULL"); qdf_mem_free(session_entry->assocRsp); session_entry->assocRsp = NULL; @@ -950,7 +950,7 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, /* STA entry was created during pre-assoc state. */ sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { /* Could not add hash table entry */ pe_err("could not get hash entry at DPH"); lim_print_mac_addr(mac_ctx, hdr->sa, LOGE); 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 9804f15b1a..2031818a61 100644 --- a/core/mac/src/pe/lim/lim_process_auth_frame.c +++ b/core/mac/src/pe/lim/lim_process_auth_frame.c @@ -138,7 +138,7 @@ static void lim_process_auth_shared_system_algo(struct mac_context *mac_ctx, /* Create entry for this STA in pre-auth list */ auth_node = lim_acquire_free_pre_auth_node(mac_ctx, &mac_ctx->lim.gLimPreAuthTimerTable); - if (auth_node == NULL) { + if (!auth_node) { pe_warn("Max preauth-nodes reached"); lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGW); return; @@ -246,7 +246,7 @@ static void lim_process_auth_open_system_algo(struct mac_context *mac_ctx, /* Create entry for this STA in pre-auth list */ auth_node = lim_acquire_free_pre_auth_node(mac_ctx, &mac_ctx->lim.gLimPreAuthTimerTable); - if (auth_node == NULL) { + if (!auth_node) { pe_warn("Max pre-auth nodes reached "); lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGW); return; @@ -493,7 +493,7 @@ static void lim_process_auth_frame_type1(struct mac_context *mac_ctx, associd++) { sta_ds_ptr = dph_get_hash_entry(mac_ctx, associd, &pe_session->dph.dphHashTable); - if (NULL == sta_ds_ptr) + if (!sta_ds_ptr) continue; if (sta_ds_ptr->valid && (!qdf_mem_cmp( (uint8_t *)&sta_ds_ptr->staAddr, @@ -503,7 +503,7 @@ static void lim_process_auth_frame_type1(struct mac_context *mac_ctx, sta_ds_ptr = NULL; } - if (NULL != sta_ds_ptr + if (sta_ds_ptr #ifdef WLAN_FEATURE_11W && !sta_ds_ptr->rmfEnabled #endif @@ -644,7 +644,7 @@ static void lim_process_auth_frame_type2(struct mac_context *mac_ctx, (pe_session->limSmeState == eLIM_SME_WT_REASSOC_STATE) && (rx_auth_frm_body->authStatusCode == eSIR_MAC_SUCCESS_STATUS) && - (pe_session->ftPEContext.pFTPreAuthReq != NULL) && + (pe_session->ftPEContext.pFTPreAuthReq) && (!qdf_mem_cmp( pe_session->ftPEContext.pFTPreAuthReq->preAuthbssId, mac_hdr->sa, sizeof(tSirMacAddr)))) { @@ -654,7 +654,7 @@ static void lim_process_auth_frame_type2(struct mac_context *mac_ctx, pe_session->limSmeState, mac_hdr->sa); pe_session->ftPEContext.saved_auth_rsp_length = 0; - if ((body_ptr != NULL) && (frame_len < MAX_FTIE_SIZE)) { + if ((body_ptr) && (frame_len < MAX_FTIE_SIZE)) { qdf_mem_copy( pe_session->ftPEContext.saved_auth_rsp, body_ptr, frame_len); @@ -755,7 +755,7 @@ static void lim_process_auth_frame_type2(struct mac_context *mac_ctx, pe_session->limCurrentAuthType = eSIR_OPEN_SYSTEM; auth_node = lim_acquire_free_pre_auth_node(mac_ctx, &mac_ctx->lim.gLimPreAuthTimerTable); - if (auth_node == NULL) { + if (!auth_node) { pe_warn("Max pre-auth nodes reached"); lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGW); return; @@ -938,7 +938,7 @@ static void lim_process_auth_frame_type3(struct mac_context *mac_ctx, } auth_node = lim_search_pre_auth_list(mac_ctx, mac_hdr->sa); - if (auth_node == NULL) { + if (!auth_node) { pe_warn("received AuthFrame3 from peer that has no preauth context " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(mac_hdr->sa)); @@ -1114,7 +1114,7 @@ static void lim_process_auth_frame_type4(struct mac_context *mac_ctx, pe_session->limCurrentAuthType = eSIR_SHARED_KEY; auth_node = lim_acquire_free_pre_auth_node(mac_ctx, &mac_ctx->lim.gLimPreAuthTimerTable); - if (auth_node == NULL) { + if (!auth_node) { pe_warn("Max pre-auth nodes reached"); lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGW); return; @@ -1367,7 +1367,7 @@ lim_process_auth_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, * STA. If not, reject with unspecified failure status code */ auth_node = lim_search_pre_auth_list(mac_ctx, mac_hdr->sa); - if (auth_node == NULL) { + if (!auth_node) { pe_err("rx Auth frame with no preauth ctx with WEP bit set " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(mac_hdr->sa)); @@ -1610,12 +1610,12 @@ QDF_STATUS lim_process_auth_frame_no_session(struct mac_context *mac, uint8_t *p } } - if (pe_session == NULL) { + if (!pe_session) { pe_debug("cannot find session id in FT pre-auth phase"); return QDF_STATUS_E_FAILURE; } - if (pe_session->ftPEContext.pFTPreAuthReq == NULL) { + if (!pe_session->ftPEContext.pFTPreAuthReq) { pe_err("Error: No FT"); /* No FT in progress. */ return QDF_STATUS_E_FAILURE; 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 8f0b4e5a11..6684df1ad9 100644 --- a/core/mac/src/pe/lim/lim_process_beacon_frame.c +++ b/core/mac/src/pe/lim/lim_process_beacon_frame.c @@ -111,7 +111,7 @@ lim_process_beacon_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, if (session->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE) { - if (session->beacon != NULL) { + if (session->beacon) { qdf_mem_free(session->beacon); session->beacon = NULL; session->bcnLen = 0; diff --git a/core/mac/src/pe/lim/lim_process_cfg_updates.c b/core/mac/src/pe/lim/lim_process_cfg_updates.c index 10102d6e30..83cb868cea 100644 --- a/core/mac/src/pe/lim/lim_process_cfg_updates.c +++ b/core/mac/src/pe/lim/lim_process_cfg_updates.c @@ -43,7 +43,7 @@ void lim_set_cfg_protection(struct mac_context *mac, struct pe_session *pesessio uint32_t val = 0; struct wlan_mlme_cfg *mlme_cfg = mac->mlme_cfg; - if (pesessionEntry != NULL && LIM_IS_AP_ROLE(pesessionEntry)) { + if (pesessionEntry && LIM_IS_AP_ROLE(pesessionEntry)) { if (pesessionEntry->gLimProtectionControl == MLME_FORCE_POLICY_PROTECTION_DISABLE) qdf_mem_zero((void *)&pesessionEntry->cfgProtection, diff --git a/core/mac/src/pe/lim/lim_process_deauth_frame.c b/core/mac/src/pe/lim/lim_process_deauth_frame.c index 0fbfb9e8b0..3e693f4f39 100644 --- a/core/mac/src/pe/lim/lim_process_deauth_frame.c +++ b/core/mac/src/pe/lim/lim_process_deauth_frame.c @@ -330,7 +330,7 @@ void lim_perform_deauth(struct mac_context *mac_ctx, struct pe_session *pe_sessi sta_ds = dph_lookup_hash_entry(mac_ctx, addr, &aid, &pe_session->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_debug("Hash entry not found"); return; } @@ -429,7 +429,7 @@ void lim_perform_deauth(struct mac_context *mac_ctx, struct pe_session *pe_sessi case eLIM_MLM_IDLE_STATE: case eLIM_MLM_LINK_ESTABLISHED_STATE: #ifdef FEATURE_WLAN_TDLS - if ((NULL != sta_ds) + if ((sta_ds) && (STA_ENTRY_TDLS_PEER == sta_ds->staType)) { pe_err("received Deauth frame in state %X with " "reason code %d from Tdls peer" @@ -498,7 +498,7 @@ void lim_perform_deauth(struct mac_context *mac_ctx, struct pe_session *pe_sessi * Extract 'associated' context for STA, if any. * This is maintained by DPH and created by LIM. */ - if (NULL == sta_ds) { + if (!sta_ds) { pe_err("sta_ds is NULL"); return; } diff --git a/core/mac/src/pe/lim/lim_process_disassoc_frame.c b/core/mac/src/pe/lim/lim_process_disassoc_frame.c index 2aabe7022c..b6636512d9 100644 --- a/core/mac/src/pe/lim/lim_process_disassoc_frame.c +++ b/core/mac/src/pe/lim/lim_process_disassoc_frame.c @@ -173,7 +173,7 @@ lim_process_disassoc_frame(struct mac_context *mac, uint8_t *pRxPacketInfo, dph_lookup_hash_entry(mac, pHdr->sa, &aid, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { /** * Disassociating STA is not associated. * Log error. @@ -324,7 +324,7 @@ void lim_disassoc_tdls_peers(struct mac_context *mac_ctx, sta_ds = dph_lookup_hash_entry(mac_ctx, addr, &aid, &pe_session->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_debug("Hash entry not found"); return; } @@ -351,7 +351,7 @@ void lim_perform_disassoc(struct mac_context *mac_ctx, int32_t frame_rssi, sta_ds = dph_lookup_hash_entry(mac_ctx, addr, &aid, &pe_session->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_debug("Hash entry not found"); return; } diff --git a/core/mac/src/pe/lim/lim_process_fils.c b/core/mac/src/pe/lim/lim_process_fils.c index 58b8dd836b..9b10ea5bb1 100644 --- a/core/mac/src/pe/lim/lim_process_fils.c +++ b/core/mac/src/pe/lim/lim_process_fils.c @@ -1513,7 +1513,7 @@ static QDF_STATUS find_ie_data_after_fils_session_ie(struct mac_context *mac_ctx uint8_t *ptr = buf; uint8_t elem_id, elem_len; - if (NULL == buf || 0 == buf_len) + if (!buf || 0 == buf_len) return QDF_STATUS_E_FAILURE; while (left >= 2) { @@ -1574,9 +1574,9 @@ static int fils_aead_encrypt(const uint8_t *kek, unsigned int kek_len, return -EINVAL; } - if (own_mac == NULL || bssid == NULL || snonce == NULL || - anonce == NULL || data_len == 0 || plain_text_len == 0 || - out == NULL) { + if (!own_mac || !bssid || !snonce || + !anonce || data_len == 0 || plain_text_len == 0 || + !out) { QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, FL("Error missing params mac:%pK bssid:%pK snonce:%pK anonce:%pK data_len:%zu plain_text_len:%zu out:%pK"), own_mac, bssid, snonce, anonce, data_len, @@ -1724,9 +1724,9 @@ static int fils_aead_decrypt(const uint8_t *kek, unsigned int kek_len, return -EINVAL; } - if (own_mac == NULL || bssid == NULL || snonce == NULL || - anonce == NULL || data_len == 0 || ciphered_text_len == 0 || - plain_text == NULL) { + if (!own_mac || !bssid || !snonce || + !anonce || data_len == 0 || ciphered_text_len == 0 || + !plain_text) { QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, FL("Error missing params mac:%pK bssid:%pK snonce:%pK anonce:%pK data_len:%zu ciphered_text_len:%zu plain_text:%pK"), own_mac, bssid, snonce, anonce, data_len, 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 a436361118..ca8d763d9a 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -195,7 +195,7 @@ static void lim_process_sae_msg(struct mac_context *mac, struct sir_sae_msg *bod session = pe_find_session_by_sme_session_id(mac, sae_msg->session_id); - if (session == NULL) { + if (!session) { pe_err("SAE:Unable to find session"); return; } @@ -788,7 +788,7 @@ __lim_handle_beacon(struct mac_context *mac, struct scheduler_msg *pMsg, /* This function should not be called if beacon is received in scan state. */ /* So not doing any checks for the global state. */ - if (pe_session == NULL) { + if (!pe_session) { sch_beacon_process(mac, pRxPacketInfo, NULL); } else if ((pe_session->limSmeState == eLIM_SME_LINK_EST_STATE) || (pe_session->limSmeState == eLIM_SME_NORMAL_STATE)) { @@ -1089,7 +1089,7 @@ lim_check_mgmt_registered_frames(struct mac_context *mac_ctx, uint8_t *buff_desc (qdf_list_node_t **) &mgmt_frame); qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock); - while (mgmt_frame != NULL) { + while (mgmt_frame) { type = (mgmt_frame->frameType >> 2) & 0x03; sub_type = (mgmt_frame->frameType >> 4) & 0x0f; if ((type == SIR_MAC_MGMT_FRAME) @@ -1284,7 +1284,7 @@ lim_handle80211_frames(struct mac_context *mac, struct scheduler_msg *limMsg, /* Added For BT-AMP Support */ pe_session = pe_find_session_by_bssid(mac, pHdr->bssId, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { if (fc.subType == SIR_MAC_MGMT_AUTH) { pe_debug("ProtVersion %d, Type %d, Subtype %d rateIndex=%d", fc.protVer, fc.type, fc.subType, @@ -1304,7 +1304,7 @@ lim_handle80211_frames(struct mac_context *mac, struct scheduler_msg *limMsg, pe_session = pe_find_session_by_peer_sta(mac, pHdr->sa, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_debug("session does not exist for bssId"); lim_print_mac_addr(mac, pHdr->sa, LOGD); goto end; @@ -1424,7 +1424,7 @@ lim_handle80211_frames(struct mac_context *mac, struct scheduler_msg *limMsg, break; case SIR_MAC_MGMT_ACTION: - if (pe_session == NULL) + if (!pe_session) lim_process_action_frame_no_session(mac, pRxPacketInfo); else { @@ -1511,7 +1511,7 @@ static void lim_process_sme_obss_scan_ind(struct mac_context *mac_ctx, ht40_scanind = (struct sme_obss_ht40_scanind_msg *)msg->bodyptr; session = pe_find_session_by_bssid(mac_ctx, ht40_scanind->mac_addr.bytes, &session_id); - if (session == NULL) { + if (!session) { QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, "OBSS Scan not started: session id is NULL"); return; @@ -1557,7 +1557,7 @@ static void lim_process_messages(struct mac_context *mac_ctx, QDF_STATUS qdf_status; struct scheduler_msg new_msg = {0}; - if (msg == NULL) { + if (!msg) { pe_err("Message pointer is Null"); QDF_ASSERT(0); return; @@ -1621,7 +1621,7 @@ static void lim_process_messages(struct mac_context *mac_ctx, * process the msg, we will try to use 'BD' as * 'cds Pkt' which will cause a crash */ - if (msg->bodyptr == NULL) { + if (!msg->bodyptr) { pe_err("Message bodyptr is Null"); QDF_ASSERT(0); break; @@ -1746,7 +1746,7 @@ static void lim_process_messages(struct mac_context *mac_ctx, msg->type); for (i = 0; i < mac_ctx->lim.maxBssId; i++) { session_entry = &mac_ctx->lim.gpSession[i]; - if ((session_entry != NULL) && (session_entry->valid) + if ((session_entry) && (session_entry->valid) && (session_entry->pePersona == QDF_P2P_GO_MODE)) { /* Save P2P attr for Go */ qdf_mem_copy( @@ -1818,7 +1818,7 @@ static void lim_process_messages(struct mac_context *mac_ctx, * is rcvd within the Heart Beat interval continue * normal processing */ - if (NULL == msg->bodyptr) + if (!msg->bodyptr) pe_err("Can't Process HB TO - bodyptr is Null"); else { session_entry = (struct pe_session *) msg->bodyptr; @@ -1879,7 +1879,7 @@ static void lim_process_messages(struct mac_context *mac_ctx, break; case WMA_SET_MAX_TX_POWER_RSP: rrm_set_max_tx_power_rsp(mac_ctx, msg); - if (msg->bodyptr != NULL) { + if (msg->bodyptr) { qdf_mem_free((void *)msg->bodyptr); msg->bodyptr = NULL; } @@ -1944,7 +1944,7 @@ static void lim_process_messages(struct mac_context *mac_ctx, vdev_id = ((uint8_t *)msg->bodyptr)[i]; session_entry = pe_find_session_by_sme_session_id( mac_ctx, vdev_id); - if (session_entry == NULL) + if (!session_entry) continue; session_entry->sap_advertise_avoid_ch_ie = (uint8_t)msg->bodyval; @@ -2292,7 +2292,7 @@ handle_ht_capabilityand_ht_info(struct mac_context *mac, * For now, we might come here during init and join with pe_session = NULL; in that case just fill the globals which exist * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below */ - if (pe_session != NULL) { + if (pe_session) { pe_session->htCapability = IS_DOT11_MODE_HT(pe_session->dot11mode); pe_session->beaconParams.fLsigTXOPProtectionFullSupport = 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 a7859c352c..086a91cee2 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 @@ -65,7 +65,7 @@ void lim_process_mlm_reassoc_req(struct mac_context *mac_ctx, session = pe_find_session_by_session_id(mac_ctx, reassoc_req->sessionId); - if (NULL == session) { + if (!session) { pe_err("Session Does not exist for given sessionId: %d", reassoc_req->sessionId); qdf_mem_free(reassoc_req); @@ -179,7 +179,7 @@ static void lim_handle_sme_reaasoc_result(struct mac_context *mac, tpDphHashNode sta = NULL; uint8_t smesessionId; - if (pe_session == NULL) { + if (!pe_session) { pe_err("pe_session is NULL"); return; } @@ -188,7 +188,7 @@ static void lim_handle_sme_reaasoc_result(struct mac_context *mac, sta = dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta != NULL) { + if (sta) { sta->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON; sta->mlmStaContext.cleanupTrigger = @@ -209,7 +209,7 @@ static void lim_handle_sme_reaasoc_result(struct mac_context *mac, error: /* Delete the session if REASSOC failure occurred. */ if (resultCode != eSIR_SME_SUCCESS) { - if (NULL != pe_session) { + if (pe_session) { pe_delete_session(mac, pe_session); pe_session = NULL; } @@ -234,14 +234,14 @@ void lim_process_mlm_reassoc_cnf(struct mac_context *mac_ctx, uint32_t *msg_buf) struct pe_session *session; tLimMlmReassocCnf *lim_mlm_reassoc_cnf; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } lim_mlm_reassoc_cnf = (tLimMlmReassocCnf *) msg_buf; session = pe_find_session_by_session_id(mac_ctx, lim_mlm_reassoc_cnf->sessionId); - if (session == NULL) { + if (!session) { pe_err("session Does not exist for given session Id"); return; } @@ -353,7 +353,7 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, /* Sanity Checks */ - if (pAddBssParams == NULL) { + if (!pAddBssParams) { pe_err("Invalid parameters"); goto end; } @@ -365,7 +365,7 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, sta = dph_add_hash_entry(mac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { /* Could not add hash table entry */ pe_err("could not add hash entry at DPH for"); lim_print_mac_addr(mac, pAddBssParams->staContext.staMac, @@ -398,7 +398,7 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, goto end; } mac->lim.pe_session = pe_session; - if (NULL == mac->lim.pe_session->pLimMlmReassocRetryReq) { + if (!mac->lim.pe_session->pLimMlmReassocRetryReq) { /* Take a copy of reassoc request for retrying */ mac->lim.pe_session->pLimMlmReassocRetryReq = qdf_mem_malloc(sizeof(tLimMlmReassocReq)); @@ -518,7 +518,7 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, /* Lets save this for when we receive the Reassoc Rsp */ pe_session->ftPEContext.pAddStaReq = pAddStaParams; - if (pAddBssParams != NULL) { + if (pAddBssParams) { qdf_mem_free(pAddBssParams); pAddBssParams = NULL; limMsgQ->bodyptr = NULL; @@ -534,13 +534,13 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, end: /* Free up buffer allocated for reassocReq */ - if (pe_session != NULL) - if (pe_session->pLimMlmReassocReq != NULL) { + if (pe_session) + if (pe_session->pLimMlmReassocReq) { qdf_mem_free(pe_session->pLimMlmReassocReq); pe_session->pLimMlmReassocReq = NULL; } - if (pAddBssParams != NULL) { + if (pAddBssParams) { qdf_mem_free(pAddBssParams); pAddBssParams = NULL; limMsgQ->bodyptr = NULL; @@ -549,7 +549,7 @@ end: mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; /* Update PE session Id */ - if (pe_session != NULL) + if (pe_session) mlmReassocCnf.sessionId = pe_session->peSessionId; else mlmReassocCnf.sessionId = 0; @@ -595,7 +595,7 @@ void lim_process_mlm_ft_reassoc_req(struct mac_context *mac, return; } - if (NULL == session->ftPEContext.pAddBssReq) { + if (!session->ftPEContext.pAddBssReq) { pe_err("pAddBssReq is NULL"); return; } 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 cddbb3dbaf..b63bef7e23 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 @@ -63,7 +63,7 @@ static void lim_process_sae_auth_timeout(struct mac_context *mac_ctx) session = pe_find_session_by_session_id(mac_ctx, mac_ctx->lim.limTimers.sae_auth_timer.sessionId); - if (session == NULL) { + if (!session) { pe_err("Session does not exist for given session id"); return; } @@ -495,7 +495,7 @@ void lim_process_mlm_start_req(struct mac_context *mac_ctx, session = pe_find_session_by_session_id(mac_ctx, mlm_start_req->sessionId); - if (NULL == session) { + if (!session) { pe_err("Session Does not exist for given sessionID"); mlm_start_cnf.resultCode = eSIR_SME_REFUSED; goto end; @@ -713,7 +713,7 @@ void lim_process_mlm_join_req(struct mac_context *mac_ctx, sessionid = mlm_join_req->sessionId; session = pe_find_session_by_session_id(mac_ctx, sessionid); - if (NULL == session) { + if (!session) { pe_err("SessionId:%d does not exist", sessionid); goto error; } @@ -764,7 +764,7 @@ void lim_process_mlm_join_req(struct mac_context *mac_ctx, error: qdf_mem_free(mlm_join_req); - if (session != NULL) + if (session) session->pLimMlmJoinReq = NULL; mlmjoin_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; mlmjoin_cnf.sessionId = sessionid; @@ -844,12 +844,12 @@ static bool lim_is_preauth_ctx_exists(struct mac_context *mac_ctx, fl = (((LIM_IS_STA_ROLE(session)) && (session->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) && - ((stads != NULL) && + ((stads) && (mac_ctx->lim.gpLimMlmAuthReq->authType == stads->mlmStaContext.authType)) && (!qdf_mem_cmp(mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr, curr_bssid, sizeof(tSirMacAddr)))) || - ((preauth_node != NULL) && + ((preauth_node) && (preauth_node->authType == mac_ctx->lim.gpLimMlmAuthReq->authType))); @@ -954,7 +954,7 @@ static void lim_process_mlm_auth_req(struct mac_context *mac_ctx, uint32_t *msg) uint8_t session_id; struct pe_session *session; - if (msg == NULL) { + if (!msg) { pe_err("Buffer is Pointing to NULL"); return; } @@ -962,7 +962,7 @@ static void lim_process_mlm_auth_req(struct mac_context *mac_ctx, uint32_t *msg) mac_ctx->lim.gpLimMlmAuthReq = (tLimMlmAuthReq *) msg; session_id = mac_ctx->lim.gpLimMlmAuthReq->sessionId; session = pe_find_session_by_session_id(mac_ctx, session_id); - if (NULL == session) { + if (!session) { pe_err("SessionId:%d does not exist", session_id); qdf_mem_free(msg); mac_ctx->lim.gpLimMlmAuthReq = NULL; @@ -1125,7 +1125,7 @@ static void lim_process_mlm_assoc_req(struct mac_context *mac_ctx, uint32_t *msg tLimMlmAssocCnf mlm_assoc_cnf; struct pe_session *session_entry; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -1133,7 +1133,7 @@ static void lim_process_mlm_assoc_req(struct mac_context *mac_ctx, uint32_t *msg mlm_assoc_req = (tLimMlmAssocReq *) msg_buf; session_entry = pe_find_session_by_session_id(mac_ctx, mlm_assoc_req->sessionId); - if (session_entry == NULL) { + if (!session_entry) { pe_err("SessionId:%d Session Does not exist", mlm_assoc_req->sessionId); qdf_mem_free(mlm_assoc_req); @@ -1244,7 +1244,7 @@ lim_process_mlm_disassoc_req_ntf(struct mac_context *mac_ctx, session = pe_find_session_by_session_id(mac_ctx, mlm_disassocreq->sessionId); - if (NULL == session) { + if (!session) { pe_err("session does not exist for given sessionId %d", mlm_disassocreq->sessionId); mlm_disassoccnf.resultCode = eSIR_SME_INVALID_PARAMETERS; @@ -1325,7 +1325,7 @@ lim_process_mlm_disassoc_req_ntf(struct mac_context *mac_ctx, if (stads) mlm_state = stads->mlmStaContext.mlmState; - if ((stads == NULL) || + if ((!stads) || (stads && ((mlm_state != eLIM_MLM_LINK_ESTABLISHED_STATE) && (mlm_state != eLIM_MLM_WT_ASSOC_CNF_STATE) && @@ -1336,7 +1336,7 @@ lim_process_mlm_disassoc_req_ntf(struct mac_context *mac_ctx, */ pe_warn("Invalid MLM_DISASSOC_REQ, Addr= " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(mlm_disassocreq->peer_macaddr.bytes)); - if (stads != NULL) + if (stads) pe_err("Sta MlmState: %d", stads->mlmStaContext.mlmState); /* Prepare and Send LIM_MLM_DISASSOC_CNF */ @@ -1535,7 +1535,7 @@ lim_process_mlm_disassoc_req(struct mac_context *mac_ctx, uint32_t *msg_buf) { tLimMlmDisassocReq *mlm_disassoc_req; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -1581,7 +1581,7 @@ lim_process_mlm_deauth_req_ntf(struct mac_context *mac_ctx, mlm_deauth_req = (tLimMlmDeauthReq *) msg_buf; session = pe_find_session_by_session_id(mac_ctx, mlm_deauth_req->sessionId); - if (NULL == session) { + if (!session) { pe_err("session does not exist for given sessionId %d", mlm_deauth_req->sessionId); qdf_mem_free(mlm_deauth_req); @@ -1712,11 +1712,11 @@ lim_process_mlm_deauth_req_ntf(struct mac_context *mac_ctx, mlm_deauth_req->peer_macaddr.bytes, &aid, &session->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { /* Check if there exists pre-auth context for this STA */ auth_node = lim_search_pre_auth_list(mac_ctx, mlm_deauth_req->peer_macaddr.bytes); - if (auth_node == NULL) { + if (!auth_node) { /* * Received DEAUTH REQ for a STA that is neither * Associated nor Pre-authenticated. Log error, @@ -1826,7 +1826,7 @@ void lim_process_mlm_deauth_req(struct mac_context *mac_ctx, uint32_t *msg_buf) tLimMlmDeauthReq *mlm_deauth_req; struct pe_session *session; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -1839,7 +1839,7 @@ void lim_process_mlm_deauth_req(struct mac_context *mac_ctx, uint32_t *msg_buf) session = pe_find_session_by_session_id(mac_ctx, mlm_deauth_req->sessionId); - if (NULL == session) { + if (!session) { pe_err("session does not exist for given sessionId %d", mlm_deauth_req->sessionId); qdf_mem_free(mlm_deauth_req); @@ -1872,13 +1872,13 @@ lim_process_mlm_set_keys_req(struct mac_context *mac_ctx, uint32_t *msg_buf) tLimMlmSetKeysCnf mlm_set_keys_cnf; struct pe_session *session; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } mlm_set_keys_req = (tLimMlmSetKeysReq *) msg_buf; - if (mac_ctx->lim.gpLimMlmSetKeysReq != NULL) { + if (mac_ctx->lim.gpLimMlmSetKeysReq) { qdf_mem_zero(mac_ctx->lim.gpLimMlmSetKeysReq, sizeof(*mlm_set_keys_req)); qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq); @@ -1888,7 +1888,7 @@ lim_process_mlm_set_keys_req(struct mac_context *mac_ctx, uint32_t *msg_buf) mac_ctx->lim.gpLimMlmSetKeysReq = (void *)mlm_set_keys_req; session = pe_find_session_by_session_id(mac_ctx, mlm_set_keys_req->sessionId); - if (NULL == session) { + if (!session) { pe_err("session does not exist for given sessionId"); qdf_mem_zero(mlm_set_keys_req->key, sizeof(mlm_set_keys_req->key)); @@ -1976,7 +1976,7 @@ lim_process_mlm_set_keys_req(struct mac_context *mac_ctx, uint32_t *msg_buf) sta_ds = dph_lookup_hash_entry(mac_ctx, mlm_set_keys_req->peer_macaddr.bytes, &aid, &session->dph.dphHashTable); - if ((sta_ds == NULL) || + if ((!sta_ds) || ((sta_ds->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) && !LIM_IS_AP_ROLE(session))) { @@ -2058,7 +2058,7 @@ void lim_process_join_failure_timeout(struct mac_context *mac_ctx) session = pe_find_session_by_session_id(mac_ctx, mac_ctx->lim.limTimers.gLimJoinFailureTimer.sessionId); - if (NULL == session) { + if (!session) { pe_err("Session Does not exist for given sessionID"); return; } @@ -2122,7 +2122,7 @@ static void lim_process_periodic_join_probe_req_timer(struct mac_context *mac_ct session = pe_find_session_by_session_id(mac_ctx, mac_ctx->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId); - if (NULL == session) { + if (!session) { pe_err("session does not exist for given SessionId: %d", mac_ctx->lim.limTimers.gLimPeriodicJoinProbeReqTimer. sessionId); @@ -2167,7 +2167,7 @@ static void lim_process_auth_retry_timer(struct mac_context *mac_ctx) session_entry = pe_find_session_by_session_id(mac_ctx, mac_ctx->lim.limTimers.g_lim_periodic_auth_retry_timer.sessionId); - if (NULL == session_entry) { + if (!session_entry) { pe_err("session does not exist for given SessionId: %d", mac_ctx->lim.limTimers. g_lim_periodic_auth_retry_timer.sessionId); @@ -2223,7 +2223,7 @@ void lim_process_auth_failure_timeout(struct mac_context *mac_ctx) session = pe_find_session_by_session_id(mac_ctx, mac_ctx->lim.limTimers.gLimAuthFailureTimer.sessionId); - if (NULL == session) { + if (!session) { pe_err("Session Does not exist for given sessionID"); return; } @@ -2298,14 +2298,14 @@ lim_process_auth_rsp_timeout(struct mac_context *mac_ctx, uint32_t auth_idx) auth_node = lim_get_pre_auth_node_from_index(mac_ctx, &mac_ctx->lim.gLimPreAuthTimerTable, auth_idx); - if (NULL == auth_node) { + if (!auth_node) { pe_warn("Invalid auth node"); return; } session = pe_find_session_by_bssid(mac_ctx, auth_node->peerMacAddr, &session_id); - if (NULL == session) { + if (!session) { pe_warn("session does not exist for given BSSID"); return; } @@ -2358,7 +2358,7 @@ void lim_process_assoc_failure_timeout(struct mac_context *mac_ctx, mac_ctx->lim.limTimers.gLimReassocFailureTimer.sessionId; session = pe_find_session_by_session_id(mac_ctx, session_id); - if (NULL == session) { + if (!session) { pe_err("Session Does not exist for given sessionID"); return; } @@ -2484,7 +2484,7 @@ void lim_set_channel(struct mac_context *mac_ctx, uint8_t channel, pe_session = pe_find_session_by_session_id(mac_ctx, pe_session_id); - if (NULL == pe_session) { + if (!pe_session) { pe_err("Invalid PE session: %d", pe_session_id); return; } diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c index aa81771eec..d6d3381f87 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c @@ -79,7 +79,7 @@ lim_process_mlm_rsp_messages(struct mac_context *mac, uint32_t msgType, uint32_t *pMsgBuf) { - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -155,14 +155,14 @@ void lim_process_mlm_start_cnf(struct mac_context *mac, uint32_t *pMsgBuf) uint8_t channelId; uint8_t send_bcon_ind = false; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } pLimMlmStartCnf = (tLimMlmStartCnf *) pMsgBuf; pe_session = pe_find_session_by_session_id(mac, pLimMlmStartCnf->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session does Not exist with given sessionId"); return; } @@ -204,7 +204,7 @@ void lim_process_mlm_start_cnf(struct mac_context *mac, uint32_t *pMsgBuf) lim_send_sme_start_bss_rsp(mac, eWNI_SME_START_BSS_RSP, ((tLimMlmStartCnf *)pMsgBuf)->resultCode, pe_session, smesessionId); - if ((pe_session != NULL) && + if ((pe_session) && (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)) { channelId = pe_session->pLimStartBssReq->channelId; @@ -269,7 +269,7 @@ void lim_process_mlm_join_cnf(struct mac_context *mac_ctx, join_cnf = (tLimMlmJoinCnf *) msg; session_entry = pe_find_session_by_session_id(mac_ctx, join_cnf->sessionId); - if (session_entry == NULL) { + if (!session_entry) { pe_err("SessionId:%d does not exist", join_cnf->sessionId); return; } @@ -333,14 +333,14 @@ static void lim_send_mlm_assoc_req(struct mac_context *mac_ctx, pe_debug("SessionId: %d Authenticated with BSS", session_entry->peSessionId); - if (NULL == session_entry->pLimJoinReq) { + if (!session_entry->pLimJoinReq) { pe_err("Join Request is NULL"); /* No need to Assert. JOIN timeout will handle this error */ return; } assoc_req = qdf_mem_malloc(sizeof(tLimMlmAssocReq)); - if (NULL == assoc_req) { + if (!assoc_req) { pe_err("call to AllocateMemory failed for mlmAssocReq"); return; } @@ -453,14 +453,14 @@ void lim_process_mlm_auth_cnf(struct mac_context *mac_ctx, uint32_t *msg) tLimMlmAuthCnf *auth_cnf; struct pe_session *session_entry; - if (msg == NULL) { + if (!msg) { pe_err("Buffer is Pointing to NULL"); return; } auth_cnf = (tLimMlmAuthCnf *) msg; session_entry = pe_find_session_by_session_id(mac_ctx, auth_cnf->sessionId); - if (session_entry == NULL) { + if (!session_entry) { pe_err("SessionId:%d session doesn't exist", auth_cnf->sessionId); return; @@ -519,7 +519,7 @@ void lim_process_mlm_auth_cnf(struct mac_context *mac_ctx, uint32_t *msg) auth_mode = eSIR_OPEN_SYSTEM; /* Trigger MAC based Authentication */ auth_req = qdf_mem_malloc(sizeof(tLimMlmAuthReq)); - if (NULL == auth_req) { + if (!auth_req) { pe_err("mlmAuthReq :Memory alloc failed"); return; } @@ -591,14 +591,14 @@ void lim_process_mlm_assoc_cnf(struct mac_context *mac_ctx, struct pe_session *session_entry; tLimMlmAssocCnf *assoc_cnf; - if (msg == NULL) { + if (!msg) { pe_err("Buffer is Pointing to NULL"); return; } assoc_cnf = (tLimMlmAssocCnf *) msg; session_entry = pe_find_session_by_session_id(mac_ctx, assoc_cnf->sessionId); - if (session_entry == NULL) { + if (!session_entry) { pe_err("SessionId:%d Session does not exist", assoc_cnf->sessionId); return; @@ -786,21 +786,21 @@ void lim_process_mlm_assoc_ind(struct mac_context *mac, uint32_t *pMsgBuf) tpDphHashNode sta = 0; struct pe_session *pe_session; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } pe_session = pe_find_session_by_session_id(mac, ((tpLimMlmAssocInd) pMsgBuf)-> sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given sessionId"); return; } /* / Inform Host of STA association */ len = sizeof(struct assoc_ind); pSirSmeAssocInd = qdf_mem_malloc(len); - if (NULL == pSirSmeAssocInd) { + if (!pSirSmeAssocInd) { pe_err("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"); return; } @@ -868,7 +868,7 @@ void lim_process_mlm_disassoc_ind(struct mac_context *mac, uint32_t *pMsgBuf) pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf; pe_session = pe_find_session_by_session_id(mac, pMlmDisassocInd->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given sessionID"); return; } @@ -911,7 +911,7 @@ void lim_process_mlm_disassoc_cnf(struct mac_context *mac_ctx, session_entry = pe_find_session_by_session_id(mac_ctx, disassoc_cnf->sessionId); - if (session_entry == NULL) { + if (!session_entry) { pe_err("session Does not exist for given session Id"); return; } @@ -1035,14 +1035,14 @@ void lim_process_mlm_deauth_cnf(struct mac_context *mac, uint32_t *pMsgBuf) tLimMlmDeauthCnf *pMlmDeauthCnf; struct pe_session *pe_session; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf; pe_session = pe_find_session_by_session_id(mac, pMlmDeauthCnf->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given session Id"); return; } @@ -1111,14 +1111,14 @@ void lim_process_mlm_purge_sta_ind(struct mac_context *mac, uint32_t *pMsgBuf) tpLimMlmPurgeStaInd pMlmPurgeStaInd; struct pe_session *pe_session; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf; pe_session = pe_find_session_by_session_id(mac, pMlmPurgeStaInd->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given bssId"); return; } @@ -1197,14 +1197,14 @@ void lim_process_mlm_set_keys_cnf(struct mac_context *mac, uint32_t *pMsgBuf) uint16_t aid; tpDphHashNode sta_ds; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf; pe_session = pe_find_session_by_session_id(mac, pMlmSetKeysCnf->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given sessionId"); return; } @@ -1221,7 +1221,7 @@ void lim_process_mlm_set_keys_cnf(struct mac_context *mac, uint32_t *pMsgBuf) sta_ds = dph_lookup_hash_entry(mac, pMlmSetKeysCnf->peer_macaddr.bytes, &aid, &pe_session->dph.dphHashTable); - if (sta_ds != NULL && pMlmSetKeysCnf->key_len_nonzero) + if (sta_ds && pMlmSetKeysCnf->key_len_nonzero) sta_ds->is_key_installed = 1; } } @@ -1414,7 +1414,7 @@ void lim_handle_sme_join_result(struct mac_context *mac_ctx, uint8_t sme_session_id; join_params *param = NULL; - if (session_entry == NULL) { + if (!session_entry) { pe_err("pe_session is NULL"); return; } @@ -1427,7 +1427,7 @@ void lim_handle_sme_join_result(struct mac_context *mac_ctx, sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); - if (sta_ds != NULL) { + if (sta_ds) { sta_ds->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON; sta_ds->mlmStaContext.cleanupTrigger = @@ -1464,7 +1464,7 @@ error: if (result_code != eSIR_SME_SUCCESS && result_code != eSIR_SME_PEER_CREATE_FAILED) { param = qdf_mem_malloc(sizeof(join_params)); - if (param != NULL) { + if (param) { param->result_code = result_code; param->prot_status_code = prot_status_code; param->pe_session_id = session_entry->peSessionId; @@ -1542,7 +1542,7 @@ void lim_process_sta_mlm_add_sta_rsp(struct mac_context *mac_ctx, struct pe_session *ft_session = NULL; uint8_t ft_session_id; - if (NULL == add_sta_params) { + if (!add_sta_params) { pe_err("Encountered NULL Pointer"); return; } @@ -1590,7 +1590,7 @@ void lim_process_sta_mlm_add_sta_rsp(struct mac_context *mac_ctx, ft_session = pe_find_session_by_bssid(mac_ctx, session_entry->limReAssocbssId, &ft_session_id); - if (ft_session != NULL && + if (ft_session && ft_ctx->PreAuthKeyInfo.extSetStaKeyParamValid == true) { tpLimMlmSetKeysReq pMlmStaKeys = @@ -1608,7 +1608,7 @@ void lim_process_sta_mlm_add_sta_rsp(struct mac_context *mac_ctx, sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); - if (NULL != sta_ds) { + if (sta_ds) { sta_ds->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; sta_ds->nss = add_sta_params->nss; @@ -1667,7 +1667,7 @@ void lim_process_sta_mlm_add_sta_rsp(struct mac_context *mac_ctx, mlm_assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; } end: - if (NULL != msg->bodyptr) { + if (msg->bodyptr) { qdf_mem_free(add_sta_params); msg->bodyptr = NULL; } @@ -1716,7 +1716,7 @@ void lim_process_sta_mlm_del_bss_rsp(struct mac_context *mac, &pe_session->dph.dphHashTable); tSirResultCodes statusCode = eSIR_SME_SUCCESS; - if (NULL == pDelBssParams) { + if (!pDelBssParams) { pe_err("Invalid body pointer in message"); goto end; } @@ -1731,7 +1731,7 @@ void lim_process_sta_mlm_del_bss_rsp(struct mac_context *mac, statusCode = eSIR_SME_REFUSED; goto end; } - if (sta == NULL) { + if (!sta) { pe_err("DPH Entry for STA 1 missing"); statusCode = eSIR_SME_REFUSED; goto end; @@ -1754,7 +1754,7 @@ end: qdf_mem_free(pDelBssParams); limMsgQ->bodyptr = NULL; } - if (sta == NULL) + if (!sta) return; if ((LIM_IS_STA_ROLE(pe_session)) && (pe_session->limSmeState != @@ -1783,16 +1783,16 @@ void lim_process_ap_mlm_del_bss_rsp(struct mac_context *mac, tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr; tSirMacAddr nullBssid = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session entry passed is NULL"); - if (pDelBss != NULL) { + if (pDelBss) { qdf_mem_free(pDelBss); limMsgQ->bodyptr = NULL; } return; } - if (pDelBss == NULL) { + if (!pDelBss) { pe_err("BSS: DEL_BSS_RSP with no body!"); rc = eSIR_SME_REFUSED; goto end; @@ -1833,7 +1833,7 @@ end: pe_session->smeSessionId); pe_delete_session(mac, pe_session); - if (pDelBss != NULL) { + if (pDelBss) { qdf_mem_free(pDelBss); limMsgQ->bodyptr = NULL; } @@ -1863,7 +1863,7 @@ void lim_process_mlm_del_sta_rsp(struct mac_context *mac_ctx, tpDeleteStaParams del_sta_params; del_sta_params = (tpDeleteStaParams) msg->bodyptr; - if (NULL == del_sta_params) { + if (!del_sta_params) { pe_err("null pointer del_sta_params msg"); return; } @@ -1871,7 +1871,7 @@ void lim_process_mlm_del_sta_rsp(struct mac_context *mac_ctx, session_entry = pe_find_session_by_session_id(mac_ctx, del_sta_params->sessionId); - if (NULL == session_entry) { + if (!session_entry) { pe_err("Session Doesn't exist: %d", del_sta_params->sessionId); qdf_mem_free(del_sta_params); @@ -1914,14 +1914,14 @@ void lim_process_ap_mlm_del_sta_rsp(struct mac_context *mac_ctx, tpDphHashNode sta_ds; tSirResultCodes status_code = eSIR_SME_SUCCESS; - if (msg->bodyptr == NULL) { + if (!msg->bodyptr) { pe_err("msg->bodyptr NULL"); return; } sta_ds = dph_get_hash_entry(mac_ctx, del_sta_params->assocId, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("DPH Entry for STA %X missing", del_sta_params->assocId); status_code = eSIR_SME_REFUSED; @@ -2007,7 +2007,7 @@ void lim_process_sta_mlm_del_sta_rsp(struct mac_context *mac, tSirResultCodes statusCode = eSIR_SME_SUCCESS; tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr; - if (NULL == pDelStaParams) { + if (!pDelStaParams) { pe_err("Encountered NULL Pointer"); goto end; } @@ -2058,7 +2058,7 @@ void lim_process_ap_mlm_add_sta_rsp(struct mac_context *mac, tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr; tpDphHashNode sta = NULL; - if (NULL == pAddStaParams) { + if (!pAddStaParams) { pe_err("Invalid body pointer in message"); goto end; } @@ -2066,7 +2066,7 @@ void lim_process_ap_mlm_add_sta_rsp(struct mac_context *mac, sta = dph_get_hash_entry(mac, pAddStaParams->assocId, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { pe_err("DPH Entry for STA %X missing", pAddStaParams->assocId); goto end; } @@ -2155,16 +2155,16 @@ static void lim_process_ap_mlm_add_bss_rsp(struct mac_context *mac, uint8_t isWepEnabled = false; tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; - if (NULL == pAddBssParams) { + if (!pAddBssParams) { pe_err("Encountered NULL Pointer"); goto end; } /* TBD: free the memory before returning, do it for all places where lookup fails. */ pe_session = pe_find_session_by_session_id(mac, pAddBssParams->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given sessionId"); - if (NULL != pAddBssParams) { + if (pAddBssParams) { qdf_mem_free(pAddBssParams); limMsgQ->bodyptr = NULL; } @@ -2301,7 +2301,7 @@ lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac, tLimMlmStartCnf mlmStartCnf; tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; - if (NULL == pAddBssParams) { + if (!pAddBssParams) { pe_err("Invalid body pointer in message"); goto end; } @@ -2401,7 +2401,7 @@ lim_process_sta_add_bss_rsp_pre_assoc(struct mac_context *mac_ctx, tLimMlmAuthReq *pMlmAuthReq; tpDphHashNode sta = NULL; - if (NULL == pAddBssParams) { + if (!pAddBssParams) { pe_err("Invalid body pointer in message"); goto joinFailure; } @@ -2410,7 +2410,7 @@ lim_process_sta_add_bss_rsp_pre_assoc(struct mac_context *mac_ctx, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { /* Could not add hash table entry */ pe_err("could not add hash entry at DPH for"); lim_print_mac_addr(mac_ctx, @@ -2434,7 +2434,7 @@ lim_process_sta_add_bss_rsp_pre_assoc(struct mac_context *mac_ctx, lim_update_fils_auth_mode(session_entry, &authMode); /* Trigger MAC based Authentication */ pMlmAuthReq = qdf_mem_malloc(sizeof(tLimMlmAuthReq)); - if (NULL == pMlmAuthReq) { + if (!pMlmAuthReq) { pe_err("Allocate Memory failed for mlmAuthReq"); return; } @@ -2565,7 +2565,7 @@ lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx, sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("Session:%d Fail to add Self Entry for STA", session_entry->peSessionId); mlm_assoc_cnf.resultCode = @@ -2661,7 +2661,7 @@ void lim_process_mlm_add_bss_rsp(struct mac_context *mac_ctx, tpAddBssParams add_bss_param = (tpAddBssParams) (msg->bodyptr); tSirBssType bss_type; - if (NULL == add_bss_param) { + if (!add_bss_param) { pe_err("Encountered NULL Pointer"); return; } @@ -2677,10 +2677,10 @@ void lim_process_mlm_add_bss_rsp(struct mac_context *mac_ctx, /* Validate SME/LIM/MLME state */ session_entry = pe_find_session_by_session_id(mac_ctx, add_bss_param->sessionId); - if (session_entry == NULL) { + if (!session_entry) { pe_err("SessionId:%d Session Doesn't exist", add_bss_param->sessionId); - if (NULL != add_bss_param) { + if (add_bss_param) { qdf_mem_free(add_bss_param); msg->bodyptr = NULL; } @@ -2740,7 +2740,7 @@ void lim_process_mlm_update_hidden_ssid_rsp(struct mac_context *mac_ctx, hidden_ssid_vdev_restart = (tpHalHiddenSsidVdevRestart)(msg->bodyptr); - if (NULL == hidden_ssid_vdev_restart) { + if (!hidden_ssid_vdev_restart) { pe_err("NULL msg pointer"); return; } @@ -2748,7 +2748,7 @@ void lim_process_mlm_update_hidden_ssid_rsp(struct mac_context *mac_ctx, session_entry = pe_find_session_by_session_id(mac_ctx, hidden_ssid_vdev_restart->pe_session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("SessionId:%d Session Doesn't exist", hidden_ssid_vdev_restart->pe_session_id); goto free_req; @@ -2767,7 +2767,7 @@ void lim_process_mlm_update_hidden_ssid_rsp(struct mac_context *mac_ctx, pe_err("Failed to post message %u", status); free_req: - if (NULL != hidden_ssid_vdev_restart) { + if (hidden_ssid_vdev_restart) { qdf_mem_free(hidden_ssid_vdev_restart); msg->bodyptr = NULL; } @@ -2817,7 +2817,7 @@ void lim_process_mlm_set_sta_key_rsp(struct mac_context *mac_ctx, SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); qdf_mem_zero((void *)&mlm_set_key_cnf, sizeof(tLimMlmSetKeysCnf)); - if (NULL == msg->bodyptr) { + if (!msg->bodyptr) { pe_err("msg bodyptr is NULL"); return; } @@ -2828,7 +2828,7 @@ void lim_process_mlm_set_sta_key_rsp(struct mac_context *mac_ctx, session_id = session_entry->peSessionId; pe_debug("PE session ID %d, SME session id %d", session_id, sme_session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("session does not exist for given session_id"); qdf_mem_zero(msg->bodyptr, sizeof(*set_key_params)); qdf_mem_free(msg->bodyptr); @@ -2867,7 +2867,7 @@ void lim_process_mlm_set_sta_key_rsp(struct mac_context *mac_ctx, tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) mac_ctx->lim.gpLimMlmSetKeysReq; /* Prepare and Send LIM_MLM_SETKEYS_CNF */ - if (NULL != lpLimMlmSetKeysReq) { + if (lpLimMlmSetKeysReq) { qdf_copy_macaddr(&mlm_set_key_cnf.peer_macaddr, &lpLimMlmSetKeysReq->peer_macaddr); /* @@ -2916,7 +2916,7 @@ void lim_process_mlm_set_bss_key_rsp(struct mac_context *mac_ctx, SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); qdf_mem_zero((void *)&set_key_cnf, sizeof(tLimMlmSetKeysCnf)); - if (NULL == msg->bodyptr) { + if (!msg->bodyptr) { pe_err("msg bodyptr is null"); return; } @@ -2926,7 +2926,7 @@ void lim_process_mlm_set_bss_key_rsp(struct mac_context *mac_ctx, session_id = session_entry->peSessionId; pe_debug("PE session ID %d, SME session id %d", session_id, sme_session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("session does not exist for given sessionId [%d]", session_id); qdf_mem_zero(msg->bodyptr, sizeof(tSetBssKeyParams)); @@ -2977,7 +2977,7 @@ void lim_process_mlm_set_bss_key_rsp(struct mac_context *mac_ctx, set_key_cnf.sessionId = session_id; /* Prepare and Send LIM_MLM_SETKEYS_CNF */ - if (NULL != set_key_req) { + if (set_key_req) { qdf_copy_macaddr(&set_key_cnf.peer_macaddr, &set_key_req->peer_macaddr); /* @@ -3031,7 +3031,7 @@ static void lim_process_switch_channel_re_assoc_req(struct mac_context *mac, pMlmReassocReq = (tLimMlmReassocReq *) (pe_session->pLimMlmReassocReq); - if (pMlmReassocReq == NULL) { + if (!pMlmReassocReq) { pe_err("pLimMlmReassocReq does not exist for given switchChanSession"); mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; goto end; @@ -3059,7 +3059,7 @@ static void lim_process_switch_channel_re_assoc_req(struct mac_context *mac, return; end: /* Free up buffer allocated for reassocReq */ - if (pMlmReassocReq != NULL) { + if (pMlmReassocReq) { /* Update PE session Id */ mlmReassocCnf.sessionId = pMlmReassocReq->sessionId; qdf_mem_free(pMlmReassocReq); @@ -3103,8 +3103,8 @@ static void lim_process_switch_channel_join_req( goto error; } - if ((NULL == session_entry) || (NULL == session_entry->pLimMlmJoinReq) - || (NULL == session_entry->pLimJoinReq)) { + if ((!session_entry) || (!session_entry->pLimMlmJoinReq) + || (!session_entry->pLimJoinReq)) { pe_err("invalid pointer!!"); goto error; } @@ -3222,7 +3222,7 @@ static void lim_process_switch_channel_join_req( return; error: - if (NULL != session_entry) { + if (session_entry) { if (session_entry->pLimMlmJoinReq) { qdf_mem_free(session_entry->pLimMlmJoinReq); session_entry->pLimMlmJoinReq = NULL; @@ -3275,7 +3275,7 @@ void lim_process_switch_channel_rsp(struct mac_context *mac, void *body) peSessionId = pChnlParams->peSessionId; pe_session = pe_find_session_by_session_id(mac, peSessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given sessionId"); goto free; } @@ -3373,7 +3373,7 @@ void lim_process_rx_channel_status_event(struct mac_context *mac_ctx, void *buf) { struct lim_channel_status *chan_status = buf; - if (NULL == chan_status) { + if (!chan_status) { QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, "%s: ACS evt report buf NULL", __func__); 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 810c08d0ef..53b6b94285 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 @@ -473,7 +473,7 @@ lim_process_probe_req_frame_multiple_bss(struct mac_context *mac_ctx, { uint8_t i; - if (session != NULL) { + if (session) { if (LIM_IS_AP_ROLE(session)) { lim_indicate_probe_req_to_hdd(mac_ctx, buf_descr, session); @@ -484,7 +484,7 @@ lim_process_probe_req_frame_multiple_bss(struct mac_context *mac_ctx, for (i = 0; i < mac_ctx->lim.maxBssId; i++) { session = pe_find_session_by_session_id(mac_ctx, i); - if (session == NULL) + if (!session) continue; if (LIM_IS_AP_ROLE(session)) lim_indicate_probe_req_to_hdd(mac_ctx, diff --git a/core/mac/src/pe/lim/lim_process_probe_rsp_frame.c b/core/mac/src/pe/lim/lim_process_probe_rsp_frame.c index b5080f2ee4..38ba96c68d 100644 --- a/core/mac/src/pe/lim/lim_process_probe_rsp_frame.c +++ b/core/mac/src/pe/lim/lim_process_probe_rsp_frame.c @@ -117,7 +117,7 @@ lim_process_probe_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_Packet_info session_entry->peSessionId); probe_rsp = qdf_mem_malloc(sizeof(tSirProbeRespBeacon)); - if (NULL == probe_rsp) { + if (!probe_rsp) { pe_err("Unable to allocate memory"); return; } @@ -163,7 +163,7 @@ lim_process_probe_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_Packet_info * Either Beacon/probe response is required. * Hence store it in same buffer. */ - if (session_entry->beacon != NULL) { + if (session_entry->beacon) { qdf_mem_free(session_entry->beacon); session_entry->beacon = NULL; session_entry->bcnLen = 0; @@ -172,7 +172,7 @@ lim_process_probe_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_Packet_info WMA_GET_RX_PAYLOAD_LEN(rx_Packet_info); session_entry->beacon = qdf_mem_malloc(session_entry->bcnLen); - if (NULL == session_entry->beacon) { + if (!session_entry->beacon) { pe_err("No Memory to store beacon"); } else { /* @@ -265,7 +265,7 @@ lim_process_probe_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_Packet_info &probe_rsp->edcaParams, session_entry) != QDF_STATUS_SUCCESS) { pe_err("EDCA param process error"); - } else if (sta_ds != NULL) { + } else if (sta_ds) { /* * If needed, downgrade the * EDCA parameters 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 0e7c6bffdb..4c6792c88c 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 @@ -526,7 +526,7 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu */ session = pe_find_session_by_bssid(mac_ctx, sme_start_bss_req->bssid.bytes, &session_id); - if (session != NULL) { + if (session) { pe_warn("Session Already exists for given BSSID"); ret_code = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; session = NULL; @@ -936,15 +936,15 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu } /* if (mac_ctx->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) */ free: - if ((session != NULL) && + if ((session) && (session->pLimStartBssReq == sme_start_bss_req)) { session->pLimStartBssReq = NULL; } - if (NULL != sme_start_bss_req) + if (sme_start_bss_req) qdf_mem_free(sme_start_bss_req); - if (NULL != mlm_start_req) + if (mlm_start_req) qdf_mem_free(mlm_start_req); - if (NULL != session) { + if (session) { pe_delete_session(mac_ctx, session); session = NULL; } @@ -1211,7 +1211,7 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf) session = pe_find_session_by_bssid(mac_ctx, bss_desc->bssId, &session_id); - if (session != NULL) { + if (session) { pe_err("Session(%d) Already exists for BSSID: " MAC_ADDRESS_STR " in limSmeState = %X", session_id, @@ -1246,7 +1246,7 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf) &session_id, mac_ctx->lim.maxStation, eSIR_INFRASTRUCTURE_MODE, sme_join_req->sessionId); - if (session == NULL) { + if (!session) { pe_err("Session Can not be created"); ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; goto end; @@ -1299,7 +1299,7 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf) SIR_MAC_CISCO_OUI, SIR_MAC_CISCO_OUI_SIZE, ((uint8_t *)&bss_desc->ieFields), ie_len); - if (NULL != vendor_ie) { + if (vendor_ie) { pe_debug("Cisco vendor OUI present"); session->isCiscoVendorAP = true; } else { @@ -1608,11 +1608,11 @@ end: if (sme_join_req) { qdf_mem_free(sme_join_req); sme_join_req = NULL; - if (NULL != session) + if (session) session->pLimJoinReq = NULL; } if (ret_code != eSIR_SME_SUCCESS) { - if (NULL != session) { + if (session) { pe_delete_session(mac_ctx, session); session = NULL; } @@ -1690,7 +1690,7 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx, session_entry = pe_find_session_by_bssid(mac_ctx, reassoc_req->bssDescription.bssId, &session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("Session does not exist for given bssId"); lim_print_mac_addr(mac_ctx, reassoc_req->bssDescription.bssId, LOGE); @@ -1698,7 +1698,7 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx, session_entry = pe_find_session_by_sme_session_id(mac_ctx, sme_session_id); - if (session_entry != NULL) + if (session_entry) lim_handle_sme_join_result(mac_ctx, eSIR_SME_INVALID_PARAMETERS, eSIR_MAC_UNSPEC_FAILURE_STATUS, @@ -1963,7 +1963,7 @@ static void __lim_process_sme_disassoc_req(struct mac_context *mac, uint8_t sessionId; uint8_t smesessionId; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -1988,7 +1988,7 @@ static void __lim_process_sme_disassoc_req(struct mac_context *mac, pe_session = pe_find_session_by_bssid(mac, smeDisassocReq.bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given bssId " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(smeDisassocReq.bssid.bytes)); @@ -2176,7 +2176,7 @@ void __lim_process_sme_disassoc_cnf(struct mac_context *mac, uint32_t *pMsgBuf) pe_session = pe_find_session_by_bssid(mac, smeDisassocCnf.bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given bssId"); status = lim_prepare_disconnect_done_ind(mac, &msg, smeDisassocCnf.sme_session_id, @@ -2259,7 +2259,7 @@ void __lim_process_sme_disassoc_cnf(struct mac_context *mac, uint32_t *pMsgBuf) sta = dph_lookup_hash_entry(mac, smeDisassocCnf.peer_macaddr.bytes, &aid, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { pe_err("DISASSOC_CNF for a STA with no context, addr= " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(smeDisassocCnf.peer_macaddr.bytes)); @@ -2335,7 +2335,7 @@ static void __lim_process_sme_deauth_req(struct mac_context *mac_ctx, session_entry = pe_find_session_by_bssid(mac_ctx, sme_deauth_req.bssid.bytes, &session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("session does not exist for given bssId"); ret_code = eSIR_SME_INVALID_PARAMETERS; deauth_trigger = eLIM_HOST_DEAUTH; @@ -2521,7 +2521,7 @@ __lim_process_sme_set_context_req(struct mac_context *mac_ctx, uint8_t session_id; /* PE sessionID */ uint8_t sme_session_id; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -2553,7 +2553,7 @@ __lim_process_sme_set_context_req(struct mac_context *mac_ctx, session_entry = pe_find_session_by_bssid(mac_ctx, set_context_req->bssid.bytes, &session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("Session does not exist for given BSSID"); lim_send_sme_set_context_rsp(mac_ctx, set_context_req->peer_macaddr, 1, @@ -2800,7 +2800,7 @@ __lim_handle_sme_stop_bss_request(struct mac_context *mac, uint32_t *pMsgBuf) pe_session = pe_find_session_by_bssid(mac, stop_bss_req.bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given BSSID"); lim_send_sme_rsp(mac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS, smesessionId); @@ -2941,7 +2941,7 @@ void __lim_process_sme_assoc_cnf_new(struct mac_context *mac_ctx, uint32_t msg_t uint8_t session_id; tpSirAssocReq assoc_req; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("msg_buf is NULL"); return; } @@ -2954,7 +2954,7 @@ void __lim_process_sme_assoc_cnf_new(struct mac_context *mac_ctx, uint32_t msg_t session_entry = pe_find_session_by_bssid(mac_ctx, assoc_cnf.bssid.bytes, &session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("session does not exist for given bssId"); goto end; } @@ -2968,7 +2968,7 @@ void __lim_process_sme_assoc_cnf_new(struct mac_context *mac_ctx, uint32_t msg_t } sta_ds = dph_get_hash_entry(mac_ctx, assoc_cnf.aid, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("Rcvd invalid msg %X due to no STA ctx, aid %d, peer", msg_type, assoc_cnf.aid); lim_print_mac_addr(mac_ctx, assoc_cnf.peer_macaddr.bytes, LOGE); @@ -3063,8 +3063,8 @@ void __lim_process_sme_assoc_cnf_new(struct mac_context *mac_ctx, uint32_t msg_t session_entry); } end: - if (((session_entry != NULL) && (sta_ds != NULL)) && - (session_entry->parsedAssocReq[sta_ds->assocId] != NULL)) { + if (((session_entry) && (sta_ds)) && + (session_entry->parsedAssocReq[sta_ds->assocId])) { assoc_req = (tpSirAssocReq) session_entry->parsedAssocReq[sta_ds->assocId]; if (assoc_req->assocReqFrame) { @@ -3087,7 +3087,7 @@ static void __lim_process_sme_addts_req(struct mac_context *mac, uint32_t *pMsgB uint8_t sessionId; /* PE sessionId */ uint8_t smesessionId; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -3096,7 +3096,7 @@ static void __lim_process_sme_addts_req(struct mac_context *mac, uint32_t *pMsgB smesessionId = pSirAddts->sessionId; pe_session = pe_find_session_by_bssid(mac, pSirAddts->bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given bssId"); lim_send_sme_addts_rsp(mac, pSirAddts->rspReqd, QDF_STATUS_E_FAILURE, @@ -3128,7 +3128,7 @@ static void __lim_process_sme_addts_req(struct mac_context *mac, uint32_t *pMsgB dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { pe_err("Cannot find AP context for addts req"); goto send_failure_addts_rsp; } @@ -3238,7 +3238,7 @@ static void __lim_process_sme_delts_req(struct mac_context *mac, uint32_t *pMsgB pe_session = pe_find_session_by_bssid(mac, pDeltsReq->bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given bssId"); status = QDF_STATUS_E_FAILURE; goto end; @@ -3306,7 +3306,7 @@ static void __lim_process_sme_delts_req(struct mac_context *mac, uint32_t *pMsgB sta = dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta != NULL) { + if (sta) { lim_send_edca_params(mac, pe_session->gLimEdcaParamsActive, sta->bssId, false); status = QDF_STATUS_SUCCESS; @@ -3332,7 +3332,7 @@ void lim_process_sme_addts_rsp_timeout(struct mac_context *mac, uint32_t param) pe_session = pe_find_session_by_session_id(mac, mac->lim.limTimers.gLimAddtsRspTimer. sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given sessionID"); return; } @@ -3515,14 +3515,14 @@ static void lim_process_sme_update_config(struct mac_context *mac_ctx, struct pe_session *pe_session; pe_debug("received eWNI_SME_UPDATE_HT_CONFIG message"); - if (msg == NULL) { + if (!msg) { pe_err("Buffer is Pointing to NULL"); return; } pe_session = pe_find_session_by_sme_session_id(mac_ctx, msg->sme_session_id); - if (pe_session == NULL) { + if (!pe_session) { pe_warn("Session does not exist for given BSSID"); return; } @@ -3559,7 +3559,7 @@ lim_send_vdev_restart(struct mac_context *mac, struct scheduler_msg msgQ = {0}; QDF_STATUS retCode = QDF_STATUS_SUCCESS; - if (pe_session == NULL) { + if (!pe_session) { pe_err("Invalid parameters"); return; } @@ -3777,7 +3777,7 @@ static void __lim_process_sme_change_bi(struct mac_context *mac, pe_debug("received Update Beacon Interval message"); - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -3788,7 +3788,7 @@ static void __lim_process_sme_change_bi(struct mac_context *mac, pe_session = pe_find_session_by_bssid(mac, pChangeBIParams->bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session does not exist for given BSSID"); return; } @@ -3839,7 +3839,7 @@ static void __lim_process_sme_set_ht2040_mode(struct mac_context *mac, tpDphHashNode sta = NULL; pe_debug("received Set HT 20/40 mode message"); - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -3849,7 +3849,7 @@ static void __lim_process_sme_set_ht2040_mode(struct mac_context *mac, pe_session = pe_find_session_by_bssid(mac, pSetHT2040Mode->bssid.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_debug("Session does not exist for given BSSID"); lim_print_mac_addr(mac, pSetHT2040Mode->bssid.bytes, LOGD); return; @@ -3893,7 +3893,7 @@ static void __lim_process_sme_set_ht2040_mode(struct mac_context *mac, for (staId = 0; staId < pe_session->dph.dphHashTable.size; staId++) { sta = dph_get_hash_entry(mac, staId, &pe_session->dph.dphHashTable); - if (NULL == sta) + if (!sta) continue; if (sta->valid && sta->htSupportedChannelWidthSet) { @@ -3987,7 +3987,7 @@ lim_send_set_max_tx_power_req(struct mac_context *mac, int8_t txPower, QDF_STATUS retCode = QDF_STATUS_SUCCESS; struct scheduler_msg msgQ = {0}; - if (pe_session == NULL) { + if (!pe_session) { pe_err("Invalid parameters"); return QDF_STATUS_E_FAILURE; } @@ -4045,7 +4045,7 @@ static void __lim_process_sme_register_mgmt_frame_req(struct mac_context *mac_ct (qdf_list_node_t **) &lim_mgmt_regn); qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock); - while (lim_mgmt_regn != NULL) { + while (lim_mgmt_regn) { if (lim_mgmt_regn->frameType != sme_req->frameType) goto skip_match; if (sme_req->matchLen) { @@ -4086,7 +4086,7 @@ skip_match: lim_mgmt_regn = qdf_mem_malloc(sizeof(struct mgmt_frm_reg_info) + sme_req->matchLen); - if (lim_mgmt_regn != NULL) { + if (lim_mgmt_regn) { lim_mgmt_regn->frameType = sme_req->frameType; lim_mgmt_regn->matchLen = sme_req->matchLen; lim_mgmt_regn->sessionId = sme_req->sessionId; @@ -4114,7 +4114,7 @@ __lim_process_sme_reset_ap_caps_change(struct mac_context *mac, uint32_t *pMsgBu struct pe_session *pe_session; uint8_t sessionId = 0; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -4123,7 +4123,7 @@ __lim_process_sme_reset_ap_caps_change(struct mac_context *mac, uint32_t *pMsgBu pe_session = pe_find_session_by_bssid(mac, pResetCapsChange->bssId.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session does not exist for given BSSID"); return; } @@ -4149,7 +4149,7 @@ static void lim_register_mgmt_frame_ind_cb(struct mac_context *mac_ctx, struct sir_sme_mgmt_frame_cb_req *sme_req = (struct sir_sme_mgmt_frame_cb_req *)msg_buf; - if (NULL == msg_buf) { + if (!msg_buf) { pe_err("msg_buf is null"); return; } @@ -4246,7 +4246,7 @@ static void lim_set_pdev_ht_ie(struct mac_context *mac_ctx, uint8_t pdev_id, if (NSS_1x1_MODE == i) { p_ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_HTCAPS, ie_params->ie_ptr, ie_params->ie_len); - if (NULL == p_ie) { + if (!p_ie) { qdf_mem_free(ie_params->ie_ptr); qdf_mem_free(ie_params); pe_err("failed to get IE ptr"); @@ -4316,7 +4316,7 @@ static void lim_set_pdev_vht_ie(struct mac_context *mac_ctx, uint8_t pdev_id, if (NSS_1x1_MODE == i) { p_ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_VHTCAPS, ie_params->ie_ptr, ie_params->ie_len); - if (NULL == p_ie) { + if (!p_ie) { qdf_mem_free(ie_params->ie_ptr); qdf_mem_free(ie_params); pe_err("failed to get IE ptr"); @@ -4364,7 +4364,7 @@ static void lim_process_set_vdev_ies_per_band(struct mac_context *mac_ctx, struct sir_set_vdev_ies_per_band *p_msg = (struct sir_set_vdev_ies_per_band *)msg_buf; - if (NULL == p_msg) { + if (!p_msg) { pe_err("NULL p_msg"); return; } @@ -4393,7 +4393,7 @@ static void lim_process_set_pdev_IEs(struct mac_context *mac_ctx, uint32_t *msg_ ht_vht_cfg = (struct sir_set_ht_vht_cfg *)msg_buf; - if (NULL == ht_vht_cfg) { + if (!ht_vht_cfg) { pe_err("NULL ht_vht_cfg"); return; } @@ -4878,7 +4878,7 @@ static void lim_process_sme_start_beacon_req(struct mac_context *mac, uint32_t * struct pe_session *pe_session; uint8_t sessionId; /* PE sessionID */ - if (pMsg == NULL) { + if (!pMsg) { pe_err("Buffer is Pointing to NULL"); return; } @@ -4887,7 +4887,7 @@ static void lim_process_sme_start_beacon_req(struct mac_context *mac, uint32_t * pe_session = pe_find_session_by_bssid(mac, pBeaconStartInd->bssid, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { lim_print_mac_addr(mac, pBeaconStartInd->bssid, LOGE); pe_err("Session does not exist for given bssId"); return; @@ -4979,7 +4979,7 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, uint8_t session_id; /* PE session_id */ int8_t max_tx_pwr; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("msg_buf is NULL"); return; } @@ -4996,7 +4996,7 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, session_entry = pe_find_session_by_bssid(mac_ctx, ch_change_req->bssid, &session_id); - if (session_entry == NULL) { + if (!session_entry) { lim_print_mac_addr(mac_ctx, ch_change_req->bssid, LOGE); pe_err("Session does not exist for given bssId"); return; @@ -5093,7 +5093,7 @@ lim_start_bss_update_add_ie_buffer(struct mac_context *mac, uint8_t *pSrcData_buff, uint16_t srcDataLen) { - if (srcDataLen > 0 && pSrcData_buff != NULL) { + if (srcDataLen > 0 && pSrcData_buff) { *pDstDataLen = srcDataLen; *pDstData_buff = qdf_mem_malloc(*pDstDataLen); @@ -5135,7 +5135,7 @@ lim_update_add_ie_buffer(struct mac_context *mac, uint8_t *pSrcData_buff, uint16_t srcDataLen) { - if (NULL == pSrcData_buff) { + if (!pSrcData_buff) { pe_err("src buffer is null"); return; } @@ -5184,7 +5184,7 @@ lim_update_ibss_prop_add_ies(struct mac_context *mac, uint8_t **pDstData_buff, ibss_ie = pModifyIE->pIEBuffer; oui_length = pModifyIE->oui_length; - if ((0 == oui_length) || (NULL == ibss_ie)) { + if ((0 == oui_length) || (!ibss_ie)) { pe_err("Invalid set IBSS vendor IE command length %d", oui_length); return false; @@ -5249,7 +5249,7 @@ static void lim_process_modify_add_ies(struct mac_context *mac_ctx, bool ret = false; struct add_ie_params *add_ie_params; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("msg_buf is NULL"); return; } @@ -5259,7 +5259,7 @@ static void lim_process_modify_add_ies(struct mac_context *mac_ctx, session_entry = pe_find_session_by_bssid(mac_ctx, modify_add_ies->modifyIE.bssid.bytes, &session_id); - if (NULL == session_entry) { + if (!session_entry) { pe_err("Session not found for given bssid" MAC_ADDRESS_STR, MAC_ADDR_ARRAY(modify_add_ies->modifyIE.bssid.bytes)); @@ -5267,7 +5267,7 @@ static void lim_process_modify_add_ies(struct mac_context *mac_ctx, } if ((0 == modify_add_ies->modifyIE.ieBufferlength) || (0 == modify_add_ies->modifyIE.ieIDLen) || - (NULL == modify_add_ies->modifyIE.pIEBuffer)) { + (!modify_add_ies->modifyIE.pIEBuffer)) { pe_err("Invalid request pIEBuffer %pK ieBufferlength %d ieIDLen %d ieID %d. update Type %d", modify_add_ies->modifyIE.pIEBuffer, modify_add_ies->modifyIE.ieBufferlength, @@ -5341,7 +5341,7 @@ static void lim_process_update_add_ies(struct mac_context *mac_ctx, uint8_t *new_ptr = NULL; tSirUpdateIE *update_ie; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("msg_buf is NULL"); return; } @@ -5350,7 +5350,7 @@ static void lim_process_update_add_ies(struct mac_context *mac_ctx, session_entry = pe_find_session_by_bssid(mac_ctx, update_ie->bssid.bytes, &session_id); - if (NULL == session_entry) { + if (!session_entry) { pe_debug("Session not found for given bssid" MAC_ADDRESS_STR, MAC_ADDR_ARRAY(update_ie->bssid.bytes)); @@ -5572,7 +5572,7 @@ static void lim_process_sme_dfs_csa_ie_request(struct mac_context *mac_ctx, tLimWiderBWChannelSwitchInfo *wider_bw_ch_switch; enum offset_t ch_offset; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -5580,7 +5580,7 @@ static void lim_process_sme_dfs_csa_ie_request(struct mac_context *mac_ctx, dfs_csa_ie_req = (tSirDfsCsaIeRequest *)msg_buf; session_entry = pe_find_session_by_bssid(mac_ctx, dfs_csa_ie_req->bssid, &session_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("Session not found for given BSSID" MAC_ADDRESS_STR, MAC_ADDR_ARRAY(dfs_csa_ie_req->bssid)); return; @@ -5714,14 +5714,14 @@ static void lim_process_ext_change_channel(struct mac_context *mac_ctx, (struct sir_sme_ext_cng_chan_req *) msg; struct pe_session *session_entry = NULL; - if (NULL == msg) { + if (!msg) { pe_err("Buffer is Pointing to NULL"); return; } session_entry = pe_find_session_by_sme_session_id(mac_ctx, ext_chng_channel->session_id); - if (NULL == session_entry) { + if (!session_entry) { pe_err("Session not found for given session %d", ext_chng_channel->session_id); return; @@ -5872,7 +5872,7 @@ static void lim_process_set_ie_req(struct mac_context *mac_ctx, uint32_t *msg_bu struct send_extcap_ie *msg; QDF_STATUS status; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } diff --git a/core/mac/src/pe/lim/lim_process_tdls.c b/core/mac/src/pe/lim/lim_process_tdls.c index e5dc9e5add..aaf3048fe8 100644 --- a/core/mac/src/pe/lim/lim_process_tdls.c +++ b/core/mac/src/pe/lim/lim_process_tdls.c @@ -508,7 +508,7 @@ static QDF_STATUS lim_send_tdls_dis_req_frame(struct mac_context *mac, #endif uint8_t smeSessionId = 0; - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); return QDF_STATUS_E_FAILURE; } @@ -794,7 +794,7 @@ static QDF_STATUS lim_send_tdls_dis_rsp_frame(struct mac_context *mac, /* uint32_t tdlsChannelBondingMode; */ uint8_t smeSessionId = 0; - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); return QDF_STATUS_E_FAILURE; } @@ -996,7 +996,7 @@ static void populate_dotf_tdls_vht_aid(struct mac_context *mac, uint32_t selfDot dph_lookup_hash_entry(mac, peerMac.bytes, &aid, &pe_session->dph. dphHashTable); - if (NULL != sta) { + if (sta) { Aid->present = 1; Aid->assocId = aid | LIM_AID_MASK; /* set bit 14 and 15 1's */ } else { @@ -1367,7 +1367,7 @@ QDF_STATUS lim_send_tdls_teardown_frame(struct mac_context *mac, uint8_t qos_mode = 0; uint8_t tdls_link_type; - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); return QDF_STATUS_E_FAILURE; } @@ -1563,7 +1563,7 @@ static QDF_STATUS lim_send_tdls_setup_rsp_frame(struct mac_context *mac, /* uint32_t tdlsChannelBondingMode; */ uint8_t smeSessionId = 0; - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); return QDF_STATUS_E_FAILURE; } @@ -2045,7 +2045,7 @@ lim_tdls_populate_dot11f_ht_caps(struct mac_context *mac, * All sessionized entries will need the check below * Only in case of NO session */ - if (pe_session == NULL) { + if (!pe_session) { pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.ht_cap_info. supported_channel_width_set; @@ -2565,7 +2565,7 @@ static QDF_STATUS lim_tdls_setup_add_sta(struct mac_context *mac, return QDF_STATUS_E_FAILURE; } - if (NULL == sta) { + if (!sta) { aid = lim_assign_peer_idx(mac, pe_session); if (!aid) { @@ -2593,7 +2593,7 @@ static QDF_STATUS lim_tdls_setup_add_sta(struct mac_context *mac, sta = dph_add_hash_entry(mac, pAddStaReq->peermac.bytes, aid, &pe_session->dph.dphHashTable); - if (NULL == sta) { + if (!sta) { pe_err("add hash entry failed"); QDF_ASSERT(0); return QDF_STATUS_E_FAILURE; @@ -2722,7 +2722,7 @@ QDF_STATUS lim_process_tdls_add_sta_rsp(struct mac_context *mac, void *msg, sta = dph_lookup_hash_entry(mac, pAddStaParams->staMac, &aid, &pe_session->dph.dphHashTable); - if (NULL == sta) { + if (!sta) { pe_err("sta is NULL "); status = QDF_STATUS_E_FAILURE; goto add_sta_error; @@ -2967,7 +2967,7 @@ QDF_STATUS lim_process_sme_tdls_add_sta_req(struct mac_context *mac, pe_session = pe_find_session_by_bssid(mac, add_sta_req->bssid.bytes, &session_id); - if (pe_session == NULL) { + if (!pe_session) { pe_err("PE Session does not exist for given sme sessionId: %d", add_sta_req->session_id); goto lim_tdls_add_sta_error; @@ -3026,7 +3026,7 @@ QDF_STATUS lim_process_sme_tdls_del_sta_req(struct mac_context *mac, pe_session = pe_find_session_by_bssid(mac, del_sta_req->bssid.bytes, &session_id); - if (pe_session == NULL) { + if (!pe_session) { pe_err("PE Session does not exist for given vdev id: %d", del_sta_req->session_id); lim_send_sme_tdls_del_sta_rsp(mac, del_sta_req->session_id, @@ -3107,7 +3107,7 @@ static void lim_check_aid_and_delete_peer(struct mac_context *p_mac, (aid + i * (sizeof(uint32_t) << 3)), &session_entry->dph.dphHashTable); - if (NULL == stads) + if (!stads) goto skip; pe_debug("Deleting "MAC_ADDRESS_STR, @@ -3162,7 +3162,7 @@ QDF_STATUS lim_delete_tdls_peers(struct mac_context *mac_ctx, { pe_debug("Enter"); - if (NULL == session_entry) { + if (!session_entry) { pe_err("NULL session_entry"); return QDF_STATUS_E_FAILURE; } @@ -3208,14 +3208,14 @@ QDF_STATUS lim_process_sme_del_all_tdls_peers(struct mac_context *p_mac, uint8_t session_id; msg = (struct tdls_del_all_tdls_peers *)msg_buf; - if (msg == NULL) { + if (!msg) { pe_err("NULL msg"); return QDF_STATUS_E_FAILURE; } session_entry = pe_find_session_by_bssid(p_mac, msg->bssid.bytes, &session_id); - if (NULL == session_entry) { + if (!session_entry) { pe_err("NULL pe_session"); return QDF_STATUS_E_FAILURE; } diff --git a/core/mac/src/pe/lim/lim_reassoc_utils.c b/core/mac/src/pe/lim/lim_reassoc_utils.c index f94e7c3f39..8ace7832c0 100644 --- a/core/mac/src/pe/lim/lim_reassoc_utils.c +++ b/core/mac/src/pe/lim/lim_reassoc_utils.c @@ -146,7 +146,7 @@ void lim_handle_del_bss_in_re_assoc_context(struct mac_context *mac, pe_session->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { /* Could not add hash table entry */ pe_err("could not add hash entry at DPH for"); lim_print_mac_addr(mac, @@ -268,7 +268,7 @@ void lim_handle_add_bss_in_re_assoc_context(struct mac_context *mac, sta = dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, &pe_session->dph.dphHashTable); - if (sta == NULL) { + if (!sta) { pe_err("Fail to get STA PEER entry from hash"); mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; @@ -356,7 +356,7 @@ Error: */ bool lim_is_reassoc_in_progress(struct mac_context *mac, struct pe_session *pe_session) { - if (pe_session == NULL) + if (!pe_session) return false; if (LIM_IS_STA_ROLE(pe_session) && diff --git a/core/mac/src/pe/lim/lim_security_utils.c b/core/mac/src/pe/lim/lim_security_utils.c index bd5db23ad8..1e9f0fb80c 100644 --- a/core/mac/src/pe/lim/lim_security_utils.c +++ b/core/mac/src/pe/lim/lim_security_utils.c @@ -158,7 +158,7 @@ void lim_delete_pre_auth_list(struct mac_context *mac) struct tLimPreAuthNode *pCurrNode, *pTempNode; pCurrNode = pTempNode = mac->lim.pLimPreAuthList; - while (pCurrNode != NULL) { + while (pCurrNode) { pTempNode = pCurrNode->next; lim_release_pre_auth_node(mac, pCurrNode); @@ -193,7 +193,7 @@ struct tLimPreAuthNode *lim_search_pre_auth_list(struct mac_context *mac, { struct tLimPreAuthNode *pTempNode = mac->lim.pLimPreAuthList; - while (pTempNode != NULL) { + while (pTempNode) { if (!qdf_mem_cmp((uint8_t *) macAddr, (uint8_t *) &pTempNode->peerMacAddr, sizeof(tSirMacAddr))) @@ -223,10 +223,10 @@ lim_delete_open_auth_pre_auth_node(struct mac_context *mac_ctx) temp_node = prev_node = mac_ctx->lim.pLimPreAuthList; - if (temp_node == NULL) + if (!temp_node) return auth_node_freed; - while (temp_node != NULL) { + while (temp_node) { if (temp_node->mlmState == eLIM_MLM_AUTHENTICATED_STATE && temp_node->authType == eSIR_OPEN_SYSTEM && (qdf_mc_timer_get_system_ticks() > @@ -352,7 +352,7 @@ void lim_delete_pre_auth_node(struct mac_context *mac, tSirMacAddr macAddr) pTempNode = pPrevNode = mac->lim.pLimPreAuthList; - if (pTempNode == NULL) + if (!pTempNode) return; if (!qdf_mem_cmp((uint8_t *) macAddr, @@ -372,7 +372,7 @@ void lim_delete_pre_auth_node(struct mac_context *mac, tSirMacAddr macAddr) pTempNode = pTempNode->next; - while (pTempNode != NULL) { + while (pTempNode) { if (!qdf_mem_cmp((uint8_t *) macAddr, (uint8_t *) &pTempNode->peerMacAddr, sizeof(tSirMacAddr))) { 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 bcbe3ae669..4f84d44cb4 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 @@ -86,13 +86,13 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(struct mac_context *mac_ctx, tpSirMacMgmtHdr mac_hdr; tftSMEContext *ft_sme_context; - if (NULL == pe_session) + if (!pe_session) return; sme_sessionid = pe_session->smeSessionId; /* check this early to avoid unncessary operation */ - if (NULL == pe_session->pLimReAssocReq) + if (!pe_session->pLimReAssocReq) return; frm = qdf_mem_malloc(sizeof(*frm)); @@ -205,7 +205,7 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(struct mac_context *mac_ctx, if (!pe_session->is11Rconnection) { if (add_ie_len && add_ie) wps_ie = limGetWscIEPtr(mac_ctx, add_ie, add_ie_len); - if (NULL == wps_ie) { + if (!wps_ie) { populate_dot11f_rsn_opaque(mac_ctx, &(pe_session->pLimReAssocReq->rsnIE), &frm->RSNOpaque); @@ -371,7 +371,7 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(struct mac_context *mac_ctx, pe_debug("*** Sending Re-Assoc Request length: %d %d to", bytes, payload); - if (pe_session->assocReq != NULL) { + if (pe_session->assocReq) { qdf_mem_free(pe_session->assocReq); pe_session->assocReq = NULL; pe_session->assocReqLen = 0; @@ -407,7 +407,7 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(struct mac_context *mac_ctx, QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, (uint8_t *) frame, (bytes + ft_ies_length)); - if ((NULL != pe_session->ftPEContext.pFTPreAuthReq) && + if ((pe_session->ftPEContext.pFTPreAuthReq) && (BAND_5G == lim_get_rf_band( pe_session->ftPEContext.pFTPreAuthReq->preAuthchannelNum))) tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; @@ -417,7 +417,7 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(struct mac_context *mac_ctx, || (pe_session->pePersona == QDF_P2P_GO_MODE)) tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; - if (NULL != pe_session->assocReq) { + if (pe_session->assocReq) { qdf_mem_free(pe_session->assocReq); pe_session->assocReq = NULL; pe_session->assocReqLen = 0; @@ -481,9 +481,9 @@ void lim_send_retry_reassoc_req_frame(struct mac_context *mac, tLimMlmReassocCnf mlmReassocCnf; /* keep sme */ tLimMlmReassocReq *pTmpMlmReassocReq = NULL; - if (NULL == pTmpMlmReassocReq) { + if (!pTmpMlmReassocReq) { pTmpMlmReassocReq = qdf_mem_malloc(sizeof(tLimMlmReassocReq)); - if (NULL == pTmpMlmReassocReq) + if (!pTmpMlmReassocReq) goto end; qdf_mem_copy(pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); @@ -513,11 +513,11 @@ void lim_send_retry_reassoc_req_frame(struct mac_context *mac, end: /* Free up buffer allocated for reassocReq */ - if (pMlmReassocReq != NULL) { + if (pMlmReassocReq) { qdf_mem_free(pMlmReassocReq); pMlmReassocReq = NULL; } - if (pTmpMlmReassocReq != NULL) { + if (pTmpMlmReassocReq) { qdf_mem_free(pTmpMlmReassocReq); pTmpMlmReassocReq = NULL; } @@ -558,11 +558,11 @@ void lim_send_reassoc_req_mgmt_frame(struct mac_context *mac, bool isVHTEnabled = false; tpSirMacMgmtHdr pMacHdr; - if (NULL == pe_session) + if (!pe_session) return; smeSessionId = pe_session->smeSessionId; - if (NULL == pe_session->pLimReAssocReq) + if (!pe_session->pLimReAssocReq) return; frm = qdf_mem_malloc(sizeof(*frm)); @@ -656,7 +656,7 @@ void lim_send_reassoc_req_mgmt_frame(struct mac_context *mac, /* eliding the WPA or RSN IE, we just skip this: */ if (nAddIELen && pAddIE) wpsIe = limGetWscIEPtr(mac, pAddIE, nAddIELen); - if (NULL == wpsIe) { + if (!wpsIe) { populate_dot11f_rsn_opaque(mac, &(pe_session->pLimReAssocReq->rsnIE), &frm->RSNOpaque); @@ -742,7 +742,7 @@ void lim_send_reassoc_req_mgmt_frame(struct mac_context *mac, pe_debug("*** Sending Re-Association Request length: %d" "to", nBytes); - if (pe_session->assocReq != NULL) { + if (pe_session->assocReq) { qdf_mem_free(pe_session->assocReq); pe_session->assocReq = NULL; pe_session->assocReqLen = 0; 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 2ab6f3f765..9d6d3cadaa 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -219,7 +219,7 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, */ pesession = pe_find_session_by_bssid(mac_ctx, bssid, &sessionid); - if (pesession != NULL) + if (pesession) sme_sessionid = pesession->smeSessionId; /* The scheme here is to fill out a 'tDot11fProbeRequest' structure */ @@ -237,8 +237,8 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, * Don't include 11b rate if it is a P2P serach or probe request is * sent by P2P Client */ - if ((MLME_DOT11_MODE_11B != dot11mode) && (p2pie != NULL) && - ((pesession != NULL) && + if ((MLME_DOT11_MODE_11B != dot11mode) && (p2pie) && + ((pesession) && (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { /* * In the below API pass channel number > 14, do that it fills @@ -268,12 +268,12 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, populate_dot11f_wfatpc(mac_ctx, &pr.WFATPC, txPower, 0); - if (pesession != NULL) { + if (pesession) { pesession->htCapability = IS_DOT11_MODE_HT(dot11mode); /* Include HT Capability IE */ if (pesession->htCapability) populate_dot11f_ht_caps(mac_ctx, pesession, &pr.HTCaps); - } else { /* pesession == NULL */ + } else { /* !pesession */ if (IS_DOT11_MODE_HT(dot11mode)) populate_dot11f_ht_caps(mac_ctx, NULL, &pr.HTCaps); } @@ -293,7 +293,7 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, eHT_CHANNEL_WIDTH_40MHZ; } } - if (pesession != NULL) { + if (pesession) { pesession->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); /* Include VHT Capability IE */ if (pesession->vhtCapability) { @@ -308,11 +308,11 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, is_vht_enabled = true; } } - if (pesession != NULL) + if (pesession) populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &pr.ExtCap, pesession); - if (IS_DOT11_MODE_HE(dot11mode) && NULL != pesession) + if (IS_DOT11_MODE_HE(dot11mode) && pesession) lim_update_session_he_capable(mac_ctx, pesession); pe_debug("Populate HE IEs"); @@ -412,7 +412,7 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, * above variables. So we need to add one more check whether it * is pePersona is P2P_CLIENT or not */ - ((pesession != NULL) && + ((pesession) && (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { txflag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; } @@ -445,7 +445,7 @@ static QDF_STATUS lim_get_addn_ie_for_probe_resp(struct mac_context *mac, uint8_t *ptr = addIE; uint8_t elem_id, elem_len; - if (NULL == addIE) { + if (!addIE) { pe_err("NULL addIE pointer"); return QDF_STATUS_E_FAILURE; } @@ -516,7 +516,7 @@ lim_send_probe_rsp_mgmt_frame(struct mac_context *mac_ctx, if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) return; - if (NULL == pe_session) + if (!pe_session) return; /* @@ -691,7 +691,7 @@ lim_send_probe_rsp_mgmt_frame(struct mac_context *mac_ctx, p2p_ie = limGetP2pIEPtr(mac_ctx, &add_ie[0], addn_ie_len); - if (p2p_ie != NULL) { + if (p2p_ie) { /* get NoA attribute stream P2P IE */ noalen = lim_get_noa_attr_stream(mac_ctx, noa_stream, pe_session); @@ -794,18 +794,18 @@ lim_send_probe_rsp_mgmt_frame(struct mac_context *mac_ctx, if (!QDF_IS_STATUS_SUCCESS(qdf_status)) pe_err("Could not send Probe Response"); - if (add_ie != NULL) + if (add_ie) qdf_mem_free(add_ie); qdf_mem_free(frm); return; err_ret: - if (add_ie != NULL) + if (add_ie) qdf_mem_free(add_ie); - if (frm != NULL) + if (frm) qdf_mem_free(frm); - if (packet != NULL) + if (packet) cds_packet_free((void *)packet); return; @@ -830,7 +830,7 @@ lim_send_addts_req_action_frame(struct mac_context *mac, uint8_t txFlag = 0; uint8_t smeSessionId = 0; - if (NULL == pe_session) { + if (!pe_session) { return; } @@ -1057,7 +1057,7 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, uint16_t max_retries; #endif - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); return; } @@ -1079,7 +1079,7 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, frm.AID.associd = aid | LIM_AID_MASK; - if (NULL == sta) { + if (!sta) { populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates, pe_session); @@ -1093,7 +1093,7 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, sta->supportedRates.llaRates); } - if (LIM_IS_AP_ROLE(pe_session) && sta != NULL && + if (LIM_IS_AP_ROLE(pe_session) && sta && QDF_STATUS_SUCCESS == status_code) { assoc_req = (tpSirAssocReq) pe_session->parsedAssocReq[sta->assocId]; @@ -1101,13 +1101,13 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, * populate P2P IE in AssocRsp when assocReq from the peer * includes P2P IE */ - if (assoc_req != NULL && assoc_req->addIEPresent) + if (assoc_req && assoc_req->addIEPresent) populate_dot11_assoc_res_p2p_ie(mac_ctx, &frm.P2PAssocRes, assoc_req); } - if (NULL != sta) { + if (sta) { if (eHAL_SET == qos_mode) { if (sta->lleEnabled) { lle_mode = 1; @@ -1164,7 +1164,7 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, if (pe_session->vhtCapability && pe_session->vendor_vht_sap && - (assoc_req != NULL) && + (assoc_req) && assoc_req->vendor_vht_ie.VHTCaps.present) { pe_debug("Populate Vendor VHT IEs in Assoc Rsponse"); frm.vendor_vht_ie.present = 1; @@ -1237,7 +1237,7 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, lim_obss_send_detection_cfg(mac_ctx, pe_session, false); - if (assoc_req != NULL) { + if (assoc_req) { addn_ie_len = pe_session->add_ie_params.assocRespDataLen; /* Nonzero length indicates Assoc rsp IE available */ @@ -1599,7 +1599,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, uint8_t *mbo_ie = NULL; uint8_t mbo_ie_len = 0; - if (NULL == pe_session) { + if (!pe_session) { pe_err("pe_session is NULL"); qdf_mem_free(mlm_assoc_req); return; @@ -1608,7 +1608,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, sme_sessionid = pe_session->smeSessionId; /* check this early to avoid unncessary operation */ - if (NULL == pe_session->pLimJoinReq) { + if (!pe_session->pLimJoinReq) { pe_err("pe_session->pLimJoinReq is NULL"); qdf_mem_free(mlm_assoc_req); return; @@ -1731,7 +1731,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, if (add_ie_len && add_ie) wps_ie = limGetWscIEPtr(mac_ctx, add_ie, add_ie_len); - if (NULL == wps_ie) { + if (!wps_ie) { populate_dot11f_rsn_opaque(mac_ctx, &(pe_session->pLimJoinReq->rsnIE), &frm->RSNOpaque); @@ -2004,7 +2004,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, mbo_ie, mbo_ie_len); payload = payload + mbo_ie_len; - if (pe_session->assocReq != NULL) { + if (pe_session->assocReq) { qdf_mem_free(pe_session->assocReq); pe_session->assocReq = NULL; pe_session->assocReqLen = 0; @@ -2227,7 +2227,7 @@ lim_send_auth_mgmt_frame(struct mac_context *mac_ctx, enum rateid min_rid = RATEID_DEFAULT; uint16_t ch_freq_tx_frame = 0; - if (NULL == session) { + if (!session) { pe_err("Error: psession Entry is NULL"); return; } @@ -2275,7 +2275,7 @@ lim_send_auth_mgmt_frame(struct mac_context *mac_ctx, frame_len += lim_create_fils_auth_data(mac_ctx, auth_frame, session); if (auth_frame->authAlgoNumber == eSIR_FT_AUTH) { - if (NULL != session->ftPEContext.pFTPreAuthReq && + if (session->ftPEContext.pFTPreAuthReq && 0 != session->ftPEContext.pFTPreAuthReq-> ft_ies_length) { ft_ies_length = session->ftPEContext. @@ -2447,7 +2447,7 @@ alloc_packet: if ((auth_frame->authAlgoNumber == eSIR_FT_AUTH) && (auth_frame->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1) && - (session->ftPEContext.pFTPreAuthReq != NULL)) { + (session->ftPEContext.pFTPreAuthReq)) { if (ft_ies_length > 0) { qdf_mem_copy(body, @@ -2459,7 +2459,7 @@ alloc_packet: QDF_TRACE_LEVEL_DEBUG, (uint8_t *) body, ft_ies_length); - } else if (NULL != session->ftPEContext. + } else if (session->ftPEContext. pFTPreAuthReq->pbssDescription) { /* MDID attr is 54 */ *body = SIR_MDIE_ELEMENT_ID; @@ -2491,7 +2491,7 @@ alloc_packet: QDF_TRACE_LEVEL_DEBUG, frame, frame_len); - if ((NULL != session->ftPEContext.pFTPreAuthReq) && + if ((session->ftPEContext.pFTPreAuthReq) && (BAND_5G == lim_get_rf_band( session->ftPEContext.pFTPreAuthReq->preAuthchannelNum))) tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; @@ -2513,7 +2513,7 @@ alloc_packet: lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); - if (session->ftPEContext.pFTPreAuthReq != NULL) + if (session->ftPEContext.pFTPreAuthReq) ch_freq_tx_frame = cds_chan_to_freq( session->ftPEContext.pFTPreAuthReq->preAuthchannelNum); @@ -2554,7 +2554,7 @@ QDF_STATUS lim_send_deauth_cnf(struct mac_context *mac_ctx) session_entry = pe_find_session_by_session_id(mac_ctx, deauth_req->sessionId); - if (session_entry == NULL) { + if (!session_entry) { pe_err("session does not exist for given sessionId"); deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; @@ -2566,7 +2566,7 @@ QDF_STATUS lim_send_deauth_cnf(struct mac_context *mac_ctx) deauth_req->peer_macaddr.bytes, &aid, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; goto end; } @@ -2660,7 +2660,7 @@ QDF_STATUS lim_send_disassoc_cnf(struct mac_context *mac_ctx) pe_session = pe_find_session_by_session_id( mac_ctx, disassoc_req->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("No session for given sessionId"); disassoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; @@ -2670,7 +2670,7 @@ QDF_STATUS lim_send_disassoc_cnf(struct mac_context *mac_ctx) sta_ds = dph_lookup_hash_entry(mac_ctx, disassoc_req->peer_macaddr.bytes, &aid, &pe_session->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("StaDs Null"); disassoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; goto end; @@ -2709,7 +2709,7 @@ end: /* Update PE session ID */ disassoc_cnf.sessionId = disassoc_req->sessionId; - if (disassoc_req != NULL) { + if (disassoc_req) { /* / Free up buffer allocated for mlmDisassocReq */ qdf_mem_free(disassoc_req); mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; @@ -2821,7 +2821,7 @@ lim_send_disassoc_mgmt_frame(struct mac_context *mac, uint32_t val = 0; uint8_t smeSessionId = 0; - if (NULL == pe_session) { + if (!pe_session) { return; } @@ -2998,7 +2998,7 @@ lim_send_deauth_mgmt_frame(struct mac_context *mac, #endif uint8_t smeSessionId = 0; - if (NULL == pe_session) { + if (!pe_session) { return; } @@ -3135,7 +3135,7 @@ lim_send_deauth_mgmt_frame(struct mac_context *mac, pe_session->peSessionId, pMacHdr->fc.subType)); #ifdef FEATURE_WLAN_TDLS - if ((NULL != sta) + if ((sta) && (STA_ENTRY_TDLS_PEER == sta->staType)) { /* Queue Disassociation frame in high priority WQ */ lim_diag_mgmt_tx_event_report(mac, pMacHdr, @@ -3442,7 +3442,7 @@ lim_send_channel_switch_mgmt_frame(struct mac_context *mac, uint8_t smeSessionId = 0; - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session entry is NULL!!!"); return QDF_STATUS_E_FAILURE; } @@ -3561,7 +3561,7 @@ lim_send_extended_chan_switch_action_frame(struct mac_context *mac_ctx, uint8_t ch_spacing; tLimWiderBWChannelSwitchInfo *wide_bw_ie; - if (session_entry == NULL) { + if (!session_entry) { pe_err("Session entry is NULL!!!"); return QDF_STATUS_E_FAILURE; } @@ -3729,7 +3729,7 @@ lim_p2p_oper_chan_change_confirm_action_frame(struct mac_context *mac_ctx, uint8_t tx_flag = 0; uint8_t sme_session_id = 0; - if (session_entry == NULL) { + if (!session_entry) { pe_err("Session entry is NULL!!!"); return QDF_STATUS_E_FAILURE; } @@ -3862,8 +3862,8 @@ lim_send_neighbor_report_request_frame(struct mac_context *mac, uint8_t txFlag = 0; uint8_t smeSessionId = 0; - if (pe_session == NULL) { - pe_err("(psession == NULL) in Request to send Neighbor Report request action frame"); + if (!pe_session) { + pe_err("(!psession) in Request to send Neighbor Report request action frame"); return QDF_STATUS_E_FAILURE; } smeSessionId = pe_session->smeSessionId; @@ -3999,8 +3999,8 @@ lim_send_link_report_action_frame(struct mac_context *mac, uint8_t txFlag = 0; uint8_t smeSessionId = 0; - if (pe_session == NULL) { - pe_err("(psession == NULL) in Request to send Link Report action frame"); + if (!pe_session) { + pe_err("(!psession) in Request to send Link Report action frame"); return QDF_STATUS_E_FAILURE; } @@ -4137,8 +4137,8 @@ lim_send_radio_measure_report_action_frame(struct mac_context *mac, if (!frm) return QDF_STATUS_E_NOMEM; - if (pe_session == NULL) { - pe_err("(psession == NULL) in Request to send Beacon Report action frame"); + if (!pe_session) { + pe_err("(!psession) in Request to send Beacon Report action frame"); qdf_mem_free(frm); return QDF_STATUS_E_FAILURE; } @@ -4784,7 +4784,7 @@ static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, sme_session_id = mb_msg->session_id; session = pe_find_session_by_sme_session_id(mac_ctx, sme_session_id); - if (session == NULL) { + if (!session) { cds_packet_free((void *)packet); pe_err("session not found for given sme session %d", sme_session_id); diff --git a/core/mac/src/pe/lim/lim_send_messages.c b/core/mac/src/pe/lim/lim_send_messages.c index 30206492e4..0bced6ff17 100644 --- a/core/mac/src/pe/lim/lim_send_messages.c +++ b/core/mac/src/pe/lim/lim_send_messages.c @@ -66,7 +66,7 @@ QDF_STATUS lim_send_beacon_params(struct mac_context *mac, msgQ.bodyval = 0; pe_debug("Sending WMA_UPDATE_BEACON_IND, paramChangeBitmap in hex: %x", pUpdatedBcnParams->paramChangeBitmap); - if (NULL == pe_session) { + if (!pe_session) { qdf_mem_free(pBcnParams); MTRACE(mac_trace_msg_tx(mac, NO_SESSION, msgQ.type)); return QDF_STATUS_E_FAILURE; @@ -123,7 +123,7 @@ QDF_STATUS lim_send_switch_chnl_params(struct mac_context *mac, struct pe_session *pe_session; pe_session = pe_find_session_by_session_id(mac, peSessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Unable to get Session for session Id %d", peSessionId); return QDF_STATUS_E_FAILURE; @@ -416,7 +416,7 @@ QDF_STATUS lim_send_mode_update(struct mac_context *mac, msgQ.bodyval = 0; pe_debug("Sending WMA_UPDATE_OP_MODE, op_mode %d, sta_id %d", pVhtOpMode->opMode, pVhtOpMode->staId); - if (NULL == pe_session) + if (!pe_session) MTRACE(mac_trace_msg_tx(mac, NO_SESSION, msgQ.type)); else MTRACE(mac_trace_msg_tx(mac, @@ -449,7 +449,7 @@ QDF_STATUS lim_send_rx_nss_update(struct mac_context *mac, msgQ.bodyptr = pRxNss; msgQ.bodyval = 0; pe_debug("Sending WMA_UPDATE_RX_NSS"); - if (NULL == pe_session) + if (!pe_session) MTRACE(mac_trace_msg_tx(mac, NO_SESSION, msgQ.type)); else MTRACE(mac_trace_msg_tx(mac, @@ -484,7 +484,7 @@ QDF_STATUS lim_set_membership(struct mac_context *mac, msgQ.bodyptr = pMembership; msgQ.bodyval = 0; pe_debug("Sending WMA_UPDATE_MEMBERSHIP"); - if (NULL == pe_session) + if (!pe_session) MTRACE(mac_trace_msg_tx(mac, NO_SESSION, msgQ.type)); else MTRACE(mac_trace_msg_tx(mac, @@ -518,7 +518,7 @@ QDF_STATUS lim_set_user_pos(struct mac_context *mac, msgQ.bodyptr = pUserPos; msgQ.bodyval = 0; pe_debug("Sending WMA_UPDATE_USERPOS"); - if (NULL == pe_session) + if (!pe_session) MTRACE(mac_trace_msg_tx(mac, NO_SESSION, msgQ.type)); else MTRACE(mac_trace_msg_tx(mac, 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 6ae5d19225..dd050281d4 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 @@ -106,7 +106,7 @@ uint32_t lim_get_max_rate_flags(struct mac_context *mac_ctx, tpDphHashNode sta_d { uint32_t rate_flags = 0; - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("sta_ds is NULL"); return rate_flags; } @@ -192,7 +192,7 @@ static void lim_handle_join_rsp_status(struct mac_context *mac_ctx, struct ht_profile *ht_profile; #endif if (result_code == eSIR_SME_SUCCESS) { - if (session_entry->beacon != NULL) { + if (session_entry->beacon) { sme_join_rsp->beaconLength = session_entry->bcnLen; qdf_mem_copy(sme_join_rsp->frames, session_entry->beacon, @@ -203,7 +203,7 @@ static void lim_handle_join_rsp_status(struct mac_context *mac_ctx, pe_debug("Beacon: %d", sme_join_rsp->beaconLength); } - if (session_entry->assocReq != NULL) { + if (session_entry->assocReq) { sme_join_rsp->assocReqLength = session_entry->assocReqLen; qdf_mem_copy(sme_join_rsp->frames + @@ -216,7 +216,7 @@ static void lim_handle_join_rsp_status(struct mac_context *mac_ctx, pe_debug("AssocReq: %d", sme_join_rsp->assocReqLength); } - if (session_entry->assocRsp != NULL) { + if (session_entry->assocRsp) { sme_join_rsp->assocRspLength = session_entry->assocRspLen; qdf_mem_copy(sme_join_rsp->frames + @@ -228,7 +228,7 @@ static void lim_handle_join_rsp_status(struct mac_context *mac_ctx, session_entry->assocRsp = NULL; session_entry->assocRspLen = 0; } - if (session_entry->ricData != NULL) { + if (session_entry->ricData) { sme_join_rsp->parsedRicRspLen = session_entry->RICDataLen; qdf_mem_copy(sme_join_rsp->frames + @@ -244,7 +244,7 @@ static void lim_handle_join_rsp_status(struct mac_context *mac_ctx, sme_join_rsp->parsedRicRspLen); } #ifdef FEATURE_WLAN_ESE - if (session_entry->tspecIes != NULL) { + if (session_entry->tspecIes) { sme_join_rsp->tspecIeLen = session_entry->tspecLen; qdf_mem_copy(sme_join_rsp->frames + @@ -318,28 +318,28 @@ static void lim_handle_join_rsp_status(struct mac_context *mac_ctx, } } else { - if (session_entry->beacon != NULL) { + if (session_entry->beacon) { qdf_mem_free(session_entry->beacon); session_entry->beacon = NULL; session_entry->bcnLen = 0; } - if (session_entry->assocReq != NULL) { + if (session_entry->assocReq) { qdf_mem_free(session_entry->assocReq); session_entry->assocReq = NULL; session_entry->assocReqLen = 0; } - if (session_entry->assocRsp != NULL) { + if (session_entry->assocRsp) { qdf_mem_free(session_entry->assocRsp); session_entry->assocRsp = NULL; session_entry->assocRspLen = 0; } - if (session_entry->ricData != NULL) { + if (session_entry->ricData) { qdf_mem_free(session_entry->ricData); session_entry->ricData = NULL; session_entry->RICDataLen = 0; } #ifdef FEATURE_WLAN_ESE - if (session_entry->tspecIes != NULL) { + if (session_entry->tspecIes) { qdf_mem_free(session_entry->tspecIes); session_entry->tspecIes = NULL; session_entry->tspecLen = 0; @@ -407,7 +407,7 @@ void lim_send_sme_join_reassoc_rsp(struct mac_context *mac_ctx, pe_debug("Sending message: %s with reasonCode: %s", lim_msg_str(msg_type), lim_result_code_str(result_code)); - if (session_entry == NULL) { + if (!session_entry) { rsp_len = sizeof(*sme_join_rsp); sme_join_rsp = qdf_mem_malloc(rsp_len); if (!sme_join_rsp) @@ -438,7 +438,7 @@ void lim_send_sme_join_reassoc_rsp(struct mac_context *mac_ctx, sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("Get Self Sta Entry fail"); } else { /* Pass the peer's staId */ @@ -508,7 +508,7 @@ void lim_send_sme_start_bss_rsp(struct mac_context *mac, size = sizeof(struct start_bss_rsp); - if (pe_session == NULL) { + if (!pe_session) { pSirSmeRsp = qdf_mem_malloc(size); if (!pSirSmeRsp) return; @@ -596,13 +596,13 @@ void lim_send_sme_start_bss_rsp(struct mac_context *mac, pSirSmeRsp->length = size; pSirSmeRsp->sessionId = smesessionId; pSirSmeRsp->statusCode = resultCode; - if (pe_session != NULL) + if (pe_session) pSirSmeRsp->staId = pe_session->staId; /* else it will be always zero smeRsp StaID = 0 */ mmhMsg.type = msgType; mmhMsg.bodyptr = pSirSmeRsp; mmhMsg.bodyval = 0; - if (pe_session == NULL) { + if (!pe_session) { MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type)); } else { @@ -769,7 +769,7 @@ void lim_send_sme_disassoc_ntf(struct mac_context *mac, error: /* Delete the PE session Created */ - if ((pe_session != NULL) && LIM_IS_STA_ROLE(pe_session)) + if ((pe_session) && LIM_IS_STA_ROLE(pe_session)) pe_delete_session(mac, pe_session); if (false == failure) @@ -1206,7 +1206,7 @@ void lim_send_sme_set_context_rsp(struct mac_context *mac, mmhMsg.type = eWNI_SME_SETCONTEXT_RSP; mmhMsg.bodyptr = set_context_rsp; mmhMsg.bodyval = 0; - if (NULL == pe_session) { + if (!pe_session) { MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type)); } else { @@ -1247,7 +1247,7 @@ void lim_send_sme_addts_rsp(struct mac_context *mac, mmhMsg.type = eWNI_SME_ADDTS_RSP; mmhMsg.bodyptr = rsp; mmhMsg.bodyval = 0; - if (NULL == pe_session) { + if (!pe_session) { MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type)); } else { @@ -1281,7 +1281,7 @@ void lim_send_sme_delts_rsp(struct mac_context *mac, tpSirDeltsReq delts, if (!rsp) return; - if (pe_session != NULL) { + if (pe_session) { rsp->aid = delts->aid; qdf_copy_macaddr(&rsp->macaddr, &delts->macaddr); @@ -1296,7 +1296,7 @@ void lim_send_sme_delts_rsp(struct mac_context *mac, tpSirDeltsReq delts, mmhMsg.type = eWNI_SME_DELTS_RSP; mmhMsg.bodyptr = rsp; mmhMsg.bodyval = 0; - if (NULL == pe_session) { + if (!pe_session) { MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type)); } else { @@ -1383,7 +1383,7 @@ lim_send_sme_pe_statistics_rsp(struct mac_context *mac, uint16_t msgType, void * pe_find_session_by_sta_id(mac, pPeStats->staId, &sessionId); /* Fill the Session Id */ - if (NULL != pPeSessionEntry) { + if (pPeSessionEntry) { /* Fill the Session Id */ pPeStats->sessionId = pPeSessionEntry->smeSessionId; } @@ -1427,7 +1427,7 @@ void lim_send_sme_pe_ese_tsm_rsp(struct mac_context *mac, pPeSessionEntry = pe_find_session_by_bssid(mac, pPeStats->bssid.bytes, &sessionId); /* Fill the Session Id */ - if (NULL != pPeSessionEntry) { + if (pPeSessionEntry) { /* Fill the Session Id */ pPeStats->sessionId = pPeSessionEntry->smeSessionId; } else { @@ -1476,7 +1476,7 @@ lim_send_sme_ibss_peer_ind(struct mac_context *mac, pNewPeerInd->mesgType = msgType; pNewPeerInd->sessionId = sessionId; - if (beacon != NULL) { + if (beacon) { qdf_mem_copy((void *)((uint8_t *) pNewPeerInd + sizeof(tSmeIbssPeerInd)), (void *)beacon, beaconLen); @@ -1892,7 +1892,7 @@ void lim_handle_delete_bss_rsp(struct mac_context *mac, struct scheduler_msg *Ms pe_session = pe_find_session_by_session_id(mac, pDelBss->sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session Does not exist for given sessionID: %d", pDelBss->sessionId); qdf_mem_free(MsgQ->bodyptr); diff --git a/core/mac/src/pe/lim/lim_session.c b/core/mac/src/pe/lim/lim_session.c index 940db2dc67..67e106aab1 100644 --- a/core/mac/src/pe/lim/lim_session.c +++ b/core/mac/src/pe/lim/lim_session.c @@ -213,7 +213,7 @@ static void pe_reset_protection_callback(void *ptr) for (i = 1 ; i <= mac_ctx->mlme_cfg->sap_cfg.assoc_sta_limit ; i++) { station_hash_node = dph_get_hash_entry(mac_ctx, i, &pe_session_entry->dph.dphHashTable); - if (NULL == station_hash_node) + if (!station_hash_node) continue; lim_decide_ap_protection(mac_ctx, station_hash_node->staAddr, &beacon_params, pe_session_entry); @@ -649,9 +649,9 @@ struct pe_session *pe_create_session(struct mac_context *mac, qdf_mem_malloc(SIR_MAX_BEACON_SIZE); session_ptr->pSchBeaconFrameEnd = qdf_mem_malloc(SIR_MAX_BEACON_SIZE); - if ((NULL == session_ptr->pSchProbeRspTemplate) - || (NULL == session_ptr->pSchBeaconFrameBegin) - || (NULL == session_ptr->pSchBeaconFrameEnd)) { + if ((!session_ptr->pSchProbeRspTemplate) + || (!session_ptr->pSchBeaconFrameBegin) + || (!session_ptr->pSchBeaconFrameEnd)) { goto free_session_attrs; } } @@ -913,66 +913,66 @@ void pe_delete_session(struct mac_context *mac_ctx, struct pe_session *session) /* Delete FT related information */ lim_ft_cleanup(mac_ctx, session); - if (session->pLimStartBssReq != NULL) { + if (session->pLimStartBssReq) { qdf_mem_free(session->pLimStartBssReq); session->pLimStartBssReq = NULL; } - if (session->pLimJoinReq != NULL) { + if (session->pLimJoinReq) { qdf_mem_free(session->pLimJoinReq); session->pLimJoinReq = NULL; } - if (session->pLimReAssocReq != NULL) { + if (session->pLimReAssocReq) { qdf_mem_free(session->pLimReAssocReq); session->pLimReAssocReq = NULL; } - if (session->pLimMlmJoinReq != NULL) { + if (session->pLimMlmJoinReq) { qdf_mem_free(session->pLimMlmJoinReq); session->pLimMlmJoinReq = NULL; } - if (session->dph.dphHashTable.pHashTable != NULL) { + if (session->dph.dphHashTable.pHashTable) { qdf_mem_free(session->dph.dphHashTable.pHashTable); session->dph.dphHashTable.pHashTable = NULL; } - if (session->dph.dphHashTable.pDphNodeArray != NULL) { + if (session->dph.dphHashTable.pDphNodeArray) { qdf_mem_zero(session->dph.dphHashTable.pDphNodeArray, sizeof(struct sDphHashNode) * (SIR_SAP_MAX_NUM_PEERS + 1)); session->dph.dphHashTable.pDphNodeArray = NULL; } - if (session->gpLimPeerIdxpool != NULL) { + if (session->gpLimPeerIdxpool) { qdf_mem_free(session->gpLimPeerIdxpool); session->gpLimPeerIdxpool = NULL; } - if (session->beacon != NULL) { + if (session->beacon) { qdf_mem_free(session->beacon); session->beacon = NULL; session->bcnLen = 0; } - if (session->assocReq != NULL) { + if (session->assocReq) { qdf_mem_free(session->assocReq); session->assocReq = NULL; session->assocReqLen = 0; } - if (session->assocRsp != NULL) { + if (session->assocRsp) { qdf_mem_free(session->assocRsp); session->assocRsp = NULL; session->assocRspLen = 0; } - if (session->parsedAssocReq != NULL) { + if (session->parsedAssocReq) { tpSirAssocReq tmp_ptr = NULL; /* Cleanup the individual allocation first */ for (i = 0; i < session->dph.dphHashTable.size; i++) { - if (session->parsedAssocReq[i] == NULL) + if (!session->parsedAssocReq[i]) continue; tmp_ptr = ((tpSirAssocReq) (session->parsedAssocReq[i])); @@ -988,46 +988,46 @@ void pe_delete_session(struct mac_context *mac_ctx, struct pe_session *session) qdf_mem_free(session->parsedAssocReq); session->parsedAssocReq = NULL; } - if (NULL != session->limAssocResponseData) { + if (session->limAssocResponseData) { qdf_mem_free(session->limAssocResponseData); session->limAssocResponseData = NULL; } - if (NULL != session->pLimMlmReassocRetryReq) { + if (session->pLimMlmReassocRetryReq) { qdf_mem_free(session->pLimMlmReassocRetryReq); session->pLimMlmReassocRetryReq = NULL; } - if (NULL != session->pLimMlmReassocReq) { + if (session->pLimMlmReassocReq) { qdf_mem_free(session->pLimMlmReassocReq); session->pLimMlmReassocReq = NULL; } - if (NULL != session->pSchProbeRspTemplate) { + if (session->pSchProbeRspTemplate) { qdf_mem_free(session->pSchProbeRspTemplate); session->pSchProbeRspTemplate = NULL; } - if (NULL != session->pSchBeaconFrameBegin) { + if (session->pSchBeaconFrameBegin) { qdf_mem_free(session->pSchBeaconFrameBegin); session->pSchBeaconFrameBegin = NULL; } - if (NULL != session->pSchBeaconFrameEnd) { + if (session->pSchBeaconFrameEnd) { qdf_mem_free(session->pSchBeaconFrameEnd); session->pSchBeaconFrameEnd = NULL; } /* Must free the buffer before peSession invalid */ - if (NULL != session->add_ie_params.probeRespData_buff) { + if (session->add_ie_params.probeRespData_buff) { qdf_mem_free(session->add_ie_params.probeRespData_buff); session->add_ie_params.probeRespData_buff = NULL; session->add_ie_params.probeRespDataLen = 0; } - if (NULL != session->add_ie_params.assocRespData_buff) { + if (session->add_ie_params.assocRespData_buff) { qdf_mem_free(session->add_ie_params.assocRespData_buff); session->add_ie_params.assocRespData_buff = NULL; session->add_ie_params.assocRespDataLen = 0; } - if (NULL != session->add_ie_params.probeRespBCNData_buff) { + if (session->add_ie_params.probeRespBCNData_buff) { qdf_mem_free(session->add_ie_params.probeRespBCNData_buff); session->add_ie_params.probeRespBCNData_buff = NULL; session->add_ie_params.probeRespBCNDataLen = 0; @@ -1088,7 +1088,7 @@ struct pe_session *pe_find_session_by_peer_sta(struct mac_context *mac, uint8_t dph_lookup_hash_entry(mac, sa, &aid, &mac->lim.gpSession[i].dph. dphHashTable); - if (pSta != NULL) { + if (pSta) { *sessionId = i; return &mac->lim.gpSession[i]; } diff --git a/core/mac/src/pe/lim/lim_sta_hash_api.c b/core/mac/src/pe/lim/lim_sta_hash_api.c index 628df0bafe..cc1f13f95f 100644 --- a/core/mac/src/pe/lim/lim_sta_hash_api.c +++ b/core/mac/src/pe/lim/lim_sta_hash_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2012, 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2012, 2017-2019 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 @@ -57,7 +57,7 @@ QDF_STATUS lim_get_sta_hash_bssidx(struct mac_context *mac, uint16_t assocId, tpDphHashNode pSta = dph_get_hash_entry(mac, assocId, &pe_session->dph.dphHashTable); - if (pSta == NULL) { + if (!pSta) { pe_err("invalid STA: %d", assocId); return QDF_STATUS_E_NOENT; } diff --git a/core/mac/src/pe/lim/lim_timer_utils.c b/core/mac/src/pe/lim/lim_timer_utils.c index 78084199ba..41d71a5aa4 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.c +++ b/core/mac/src/pe/lim/lim_timer_utils.c @@ -216,7 +216,7 @@ uint32_t lim_create_timers(struct mac_context *mac) for (i = 0; i < cfgValue; i++) { mac->lim.gLimPreAuthTimerTable.pTable[i] = qdf_mem_malloc(sizeof(tLimPreAuthNode)); - if (mac->lim.gLimPreAuthTimerTable.pTable[i] == NULL) { + if (!mac->lim.gLimPreAuthTimerTable.pTable[i]) { mac->lim.gLimPreAuthTimerTable.numEntry = 0; goto err_timer; } @@ -276,7 +276,7 @@ err_timer: tx_timer_delete(&mac->lim.limTimers.gLimChannelSwitchTimer); tx_timer_delete(&mac->lim.limTimers.sae_auth_timer); - if (NULL != mac->lim.gLimPreAuthTimerTable.pTable) { + if (mac->lim.gLimPreAuthTimerTable.pTable) { for (i = 0; i < mac->lim.gLimPreAuthTimerTable.numEntry; i++) qdf_mem_free(mac->lim.gLimPreAuthTimerTable.pTable[i]); qdf_mem_free(mac->lim.gLimPreAuthTimerTable.pTable); @@ -418,7 +418,7 @@ void lim_assoc_failure_timer_handler(void *mac_global, uint32_t param) struct pe_session *session = NULL; session = mac_ctx->lim.pe_session; - if (LIM_REASSOC == param && NULL != session + if (LIM_REASSOC == param && session && session->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE) { pe_err("Reassoc timeout happened"); if (mac_ctx->lim.reAssocRetryAttempt < @@ -432,7 +432,7 @@ void lim_assoc_failure_timer_handler(void *mac_global, uint32_t param) } else { pe_warn("Reassoc request retry MAX: %d reached", LIM_MAX_REASSOC_RETRY_LIMIT); - if (NULL != session->pLimMlmReassocRetryReq) { + if (session->pLimMlmReassocRetryReq) { qdf_mem_free(session->pLimMlmReassocRetryReq); session->pLimMlmReassocRetryReq = NULL; } @@ -599,7 +599,7 @@ void lim_deactivate_and_change_timer(struct mac_context *mac, uint32_t timerId) session_entry = pe_find_session_by_session_id(mac, mac->lim.limTimers. g_lim_periodic_auth_retry_timer.sessionId); - if (NULL == session_entry) { + if (!session_entry) { pe_err("session does not exist for given SessionId : %d", mac->lim.limTimers. g_lim_periodic_auth_retry_timer.sessionId); @@ -791,7 +791,7 @@ lim_deactivate_and_change_per_sta_id_timer(struct mac_context *mac, uint32_t tim gLimPreAuthTimerTable, staId); - if (pAuthNode == NULL) { + if (!pAuthNode) { pe_err("Invalid Pre Auth Index passed :%d", staId); break; diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index 4a1b362f5c..d1369e6231 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -774,7 +774,7 @@ lim_post_sme_message(struct mac_context *mac, uint32_t msgType, uint32_t *pMsgBu { struct scheduler_msg msg = {0}; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } @@ -821,7 +821,7 @@ lim_post_mlm_message(struct mac_context *mac, uint32_t msgType, uint32_t *pMsgBu { struct scheduler_msg msg = {0}; - if (pMsgBuf == NULL) { + if (!pMsgBuf) { pe_err("Buffer is Pointing to NULL"); return; } diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 98928a415c..921ffbc5d5 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -81,7 +81,7 @@ void lim_delete_dialogue_token_list(struct mac_context *mac) { tpDialogueToken pCurrNode = mac->lim.pDialogueTokenHead; - while (NULL != mac->lim.pDialogueTokenHead) { + while (mac->lim.pDialogueTokenHead) { pCurrNode = mac->lim.pDialogueTokenHead; mac->lim.pDialogueTokenHead = mac->lim.pDialogueTokenHead->next; @@ -868,7 +868,7 @@ void lim_handle_update_olbc_cache(struct mac_context *mac_ctx) struct pe_session *pe_session = lim_is_ap_session_active(mac_ctx); - if (pe_session == NULL) { + if (!pe_session) { pe_err(" Session not found"); return; } @@ -1090,7 +1090,7 @@ lim_decide_ap_protection(struct mac_context *mac, tSirMacAddr peerMacAddr, sta = dph_lookup_hash_entry(mac, peerMacAddr, &tmpAid, &pe_session->dph.dphHashTable); - if (NULL == sta) { + if (!sta) { pe_err("sta is NULL"); return; } @@ -1236,7 +1236,7 @@ lim_update_short_preamble(struct mac_context *mac_ctx, tSirMacAddr peer_mac_addr lim_get_phy_mode(mac_ctx, &phy_mode, psession_entry); - if (sta_ds == NULL || phy_mode != WNI_CFG_PHY_MODE_11G) + if (!sta_ds || phy_mode != WNI_CFG_PHY_MODE_11G) return; if (sta_ds->shortPreambleEnabled != eHAL_CLEAR) @@ -1342,7 +1342,7 @@ lim_update_short_slot_time(struct mac_context *mac_ctx, tSirMacAddr peer_mac_add &session_entry->dph.dphHashTable); lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); - if (sta_ds == NULL || phy_mode != WNI_CFG_PHY_MODE_11G) + if (!sta_ds || phy_mode != WNI_CFG_PHY_MODE_11G) return; /* @@ -2149,7 +2149,7 @@ lim_util_count_sta_del(struct mac_context *mac, tpDphHashNode pSta, struct pe_session *pe_session) { - if ((pSta == NULL) || (!pSta->fAniCount)) + if ((!pSta) || (!pSta->fAniCount)) return; /* Only if sta is invalid and the validInDummyState bit is set to 1, @@ -2760,7 +2760,7 @@ lim_update_11a_protection(struct mac_context *mac_ctx, uint8_t enable, uint8_t overlap, tpUpdateBeaconParams bcn_prms, struct pe_session *session) { - if (NULL == session) { + if (!session) { pe_err("session is NULL"); return QDF_STATUS_E_FAILURE; } @@ -4202,7 +4202,7 @@ lim_validate_delts_req(struct mac_context *mac_ctx, tpSirDeltsReq delts_req, * - verify sta is in assoc state * - del sta tspec locally */ - if (delts_req == NULL) { + if (!delts_req) { pe_err("Delete TS request pointer is NULL"); return QDF_STATUS_E_FAILURE; } @@ -4232,13 +4232,13 @@ lim_validate_delts_req(struct mac_context *mac_ctx, tpSirDeltsReq delts_req, &session->dph. dphHashTable); - if (sta != NULL) + if (sta) /* TBD: check sta assoc state as well */ for (i = 0; i < sizeof(tSirMacAddr); i++) macaddr[i] = sta->staAddr[i]; } - if (sta == NULL) { + if (!sta) { pe_err("Cannot find station context for delts req"); return QDF_STATUS_E_FAILURE; } @@ -4746,7 +4746,7 @@ void lim_process_add_sta_rsp(struct mac_context *mac_ctx, session = pe_find_session_by_session_id(mac_ctx, add_sta_params->sessionId); - if (session == NULL) { + if (!session) { pe_err("Session Does not exist for given sessionID"); qdf_mem_free(add_sta_params); return; @@ -4919,7 +4919,7 @@ void lim_handle_defer_msg_error(struct mac_context *mac, lim_decrement_pending_mgmt_count(mac); cds_pkt_return_packet((cds_pkt_t *) pLimMsg->bodyptr); pLimMsg->bodyptr = NULL; - } else if (pLimMsg->bodyptr != NULL) { + } else if (pLimMsg->bodyptr) { qdf_mem_free(pLimMsg->bodyptr); pLimMsg->bodyptr = NULL; } @@ -4947,7 +4947,7 @@ void lim_diag_event_report(struct mac_context *mac, uint16_t eventType, qdf_mem_zero(&peEvent, sizeof(host_event_wlan_pe_payload_type)); - if (NULL == pe_session) { + if (!pe_session) { qdf_mem_copy(peEvent.bssid, nullBssid, sizeof(tSirMacAddr)); peEvent.sme_state = (uint16_t) mac->lim.gLimSmeState; peEvent.mlm_state = (uint16_t) mac->lim.gLimMlmState; @@ -5064,7 +5064,7 @@ uint8_t lim_get_noa_attr_stream(struct mac_context *mac, uint8_t *pNoaStream, uint8_t *pBody = pNoaStream; - if ((pe_session != NULL) && (pe_session->valid) && + if ((pe_session) && (pe_session->valid) && (pe_session->pePersona == QDF_P2P_GO_MODE)) { if ((!(pe_session->p2pGoPsUpdate.uNoa1Duration)) && (!(pe_session->p2pGoPsUpdate.uNoa2Duration)) @@ -5176,14 +5176,14 @@ void lim_pmf_sa_query_timer_handler(void *pMacGlobal, uint32_t param) /* Check that SA Query is in progress */ pe_session = pe_find_session_by_session_id(mac, timerId.fields.sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("Session does not exist for given session ID: %d", timerId.fields.sessionId); return; } pSta = dph_get_hash_entry(mac, timerId.fields.peerIdx, &pe_session->dph.dphHashTable); - if (pSta == NULL) { + if (!pSta) { pe_err("Entry does not exist for given peer index: %d", timerId.fields.peerIdx); return; @@ -5365,7 +5365,7 @@ lim_set_protected_bit(struct mac_context *mac, sta = dph_lookup_hash_entry(mac, peer, &aid, &pe_session->dph.dphHashTable); - if (sta != NULL) { + if (sta) { /* rmfenabled will be set at the time of addbss. * but sometimes EAP auth fails and keys are not * installed then if we send any management frame @@ -5533,7 +5533,7 @@ void lim_set_vht_caps(struct mac_context *p_mac, struct pe_session *p_session_en bool lim_validate_received_frame_a1_addr(struct mac_context *mac_ctx, tSirMacAddr a1, struct pe_session *session) { - if (mac_ctx == NULL || session == NULL) { + if (!mac_ctx || !session) { pe_err("mac or session context is null"); /* let main routine handle it */ return true; @@ -5906,7 +5906,7 @@ QDF_STATUS lim_send_ext_cap_ie(struct mac_context *mac_ctx, num_bytes = ext_cap_data.num_bytes; - if (merge && NULL != extra_extcap && extra_extcap->num_bytes > 0) { + if (merge && extra_extcap && extra_extcap->num_bytes > 0) { if (extra_extcap->num_bytes > ext_cap_data.num_bytes) num_bytes = extra_extcap->num_bytes; lim_merge_extcap_struct(&ext_cap_data, extra_extcap, true); @@ -5970,7 +5970,7 @@ QDF_STATUS lim_strip_ie(struct mac_context *mac_ctx, uint8_t elem_id; uint16_t elem_len; - if (NULL == addn_ie) { + if (!addn_ie) { pe_debug("NULL addn_ie pointer"); return QDF_STATUS_E_INVAL; } @@ -6008,7 +6008,7 @@ QDF_STATUS lim_strip_ie(struct mac_context *mac_ctx, * eid matched and if provided OUI also matched * take oui IE and store in provided buffer. */ - if (NULL != extracted_ie) { + if (extracted_ie) { qdf_mem_zero(extracted_ie, eid_max_len + size_of_len_field + 1); if (elem_len <= eid_max_len) @@ -6039,7 +6039,7 @@ void lim_del_pmf_sa_query_timer(struct mac_context *mac_ctx, struct pe_session * associated_sta++) { sta_ds = dph_get_hash_entry(mac_ctx, associated_sta, &pe_session->dph.dphHashTable); - if (NULL == sta_ds) + if (!sta_ds) continue; if (!sta_ds->rmfEnabled) { pe_debug("no PMF timer for sta-idx:%d assoc-id:%d", @@ -6108,12 +6108,12 @@ void lim_update_extcap_struct(struct mac_context *mac_ctx, uint8_t out[DOT11F_IE_EXTCAP_MAX_LEN]; uint32_t status; - if (NULL == buf) { + if (!buf) { pe_err("Invalid Buffer Address"); return; } - if (NULL == dst) { + if (!dst) { pe_err("NULL dst pointer"); return; } @@ -7389,7 +7389,7 @@ QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx, if (!IS_DOT11_MODE_HE(self_sta_dot11mode)) return QDF_STATUS_SUCCESS; - if ((peer_he_caps == NULL) || (!peer_he_caps->present)) { + if ((!peer_he_caps) || (!peer_he_caps->present)) { pe_debug("peer not he capable or he_caps NULL"); return QDF_STATUS_SUCCESS; } @@ -7603,7 +7603,7 @@ bool lim_check_if_vendor_oui_match(struct mac_context *mac_ctx, uint8_t *ptr = ie; uint8_t elem_id; - if (NULL == ie || 0 == ie_len) { + if (!ie || 0 == ie_len) { pe_err("IE Null or ie len zero %d", ie_len); return false; } diff --git a/core/mac/src/pe/nan/nan_datapath.c b/core/mac/src/pe/nan/nan_datapath.c index 19b3064e66..d28b83f111 100644 --- a/core/mac/src/pe/nan/nan_datapath.c +++ b/core/mac/src/pe/nan/nan_datapath.c @@ -58,7 +58,7 @@ static QDF_STATUS lim_add_ndi_peer(struct mac_context *mac_ctx, session = pe_find_session_by_sme_session_id(mac_ctx, vdev_id); - if (session == NULL) { + if (!session) { /* couldn't find session */ pe_err("Session not found for vdev_id: %d", vdev_id); return QDF_STATUS_E_FAILURE; @@ -68,7 +68,7 @@ static QDF_STATUS lim_add_ndi_peer(struct mac_context *mac_ctx, peer_mac_addr.bytes, &assoc_id, &session->dph.dphHashTable); /* peer exists, don't do anything */ - if (sta_ds != NULL) { + if (sta_ds) { pe_err("NDI Peer already exists!!"); return QDF_STATUS_SUCCESS; } @@ -83,7 +83,7 @@ static QDF_STATUS lim_add_ndi_peer(struct mac_context *mac_ctx, sta_ds = dph_add_hash_entry(mac_ctx, peer_mac_addr.bytes, peer_idx, &session->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("Couldn't add dph entry"); /* couldn't add dph entry */ return QDF_STATUS_E_FAILURE; @@ -352,7 +352,7 @@ void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx, tLimMlmStartCnf mlm_start_cnf; tpAddBssParams add_bss_params = (tpAddBssParams) lim_msgq->bodyptr; - if (NULL == add_bss_params) { + if (!add_bss_params) { pe_err("Invalid body pointer in message"); goto end; } @@ -400,7 +400,7 @@ void lim_ndi_del_bss_rsp(struct mac_context * mac_ctx, tpDeleteBssParams del_bss = (tpDeleteBssParams) msg; SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); - if (del_bss == NULL) { + if (!del_bss) { pe_err("NDI: DEL_BSS_RSP with no body!"); rc = eSIR_SME_STOP_BSS_FAILURE; goto end; @@ -433,7 +433,7 @@ end: if (del_bss) qdf_mem_free(del_bss); /* Delete PE session once BSS is deleted */ - if (NULL != session_entry) { + if (session_entry) { lim_send_sme_rsp(mac_ctx, eWNI_SME_STOP_BSS_RSP, rc, session_entry->smeSessionId); pe_delete_session(mac_ctx, session_entry); @@ -497,7 +497,7 @@ void lim_ndp_add_sta_rsp(struct mac_context *mac_ctx, struct pe_session *session tpDphHashNode sta_ds; uint16_t peer_idx; - if (NULL == add_sta_rsp) { + if (!add_sta_rsp) { pe_err("Invalid add_sta_rsp"); qdf_mem_free(add_sta_rsp); return; @@ -506,7 +506,7 @@ void lim_ndp_add_sta_rsp(struct mac_context *mac_ctx, struct pe_session *session SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); sta_ds = dph_lookup_hash_entry(mac_ctx, add_sta_rsp->staMac, &peer_idx, &session->dph.dphHashTable); - if (sta_ds == NULL) { + if (!sta_ds) { pe_err("NAN: ADD_STA_RSP for unknown MAC addr " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(add_sta_rsp->staMac)); diff --git a/core/mac/src/pe/rrm/rrm_api.c b/core/mac/src/pe/rrm/rrm_api.c index 2e31e4c908..2c4dd71db9 100644 --- a/core/mac/src/pe/rrm/rrm_api.c +++ b/core/mac/src/pe/rrm/rrm_api.c @@ -64,7 +64,7 @@ rrm_cache_mgmt_tx_power(struct mac_context *mac, int8_t txPower, { pe_debug("Cache Mgmt Tx Power: %d", txPower); - if (pe_session == NULL) + if (!pe_session) mac->rrm.rrmPEContext.txMgmtPower = txPower; else pe_session->txMgmtPower = txPower; @@ -87,7 +87,7 @@ rrm_cache_mgmt_tx_power(struct mac_context *mac, int8_t txPower, */ int8_t rrm_get_mgmt_tx_power(struct mac_context *mac, struct pe_session *pe_session) { - if (pe_session == NULL) + if (!pe_session) return mac->rrm.rrmPEContext.txMgmtPower; pe_debug("tx mgmt pwr %d", pe_session->txMgmtPower); @@ -119,7 +119,7 @@ rrm_send_set_max_tx_power_req(struct mac_context *mac, int8_t txPower, QDF_STATUS retCode = QDF_STATUS_SUCCESS; struct scheduler_msg msgQ = {0}; - if (pe_session == NULL) { + if (!pe_session) { pe_err("Invalid parameters"); return QDF_STATUS_E_FAILURE; } @@ -189,7 +189,7 @@ QDF_STATUS rrm_set_max_tx_power_rsp(struct mac_context *mac, pe_session = pe_find_session_by_bssid(mac, pMaxTxParams->bssId.bytes, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { retCode = QDF_STATUS_E_FAILURE; } else { rrm_cache_mgmt_tx_power(mac, pMaxTxParams->power, @@ -231,7 +231,7 @@ rrm_process_link_measurement_request(struct mac_context *mac, pe_debug("Received Link measurement request"); - if (pRxPacketInfo == NULL || pLinkReq == NULL || pe_session == NULL) { + if (!pRxPacketInfo || !pLinkReq || !pe_session) { pe_err("Invalid parameters - Ignoring the request"); return QDF_STATUS_E_FAILURE; } @@ -305,7 +305,7 @@ rrm_process_neighbor_report_response(struct mac_context *mac, uint8_t i; struct scheduler_msg mmhMsg = {0}; - if (pNeighborRep == NULL || pe_session == NULL) { + if (!pNeighborRep || !pe_session) { pe_err("Invalid parameters"); return status; } @@ -420,13 +420,13 @@ rrm_process_neighbor_report_req(struct mac_context *mac, struct pe_session *pe_session; uint8_t sessionId; - if (pNeighborReq == NULL) { + if (!pNeighborReq) { pe_err("NeighborReq is NULL"); return QDF_STATUS_E_FAILURE; } pe_session = pe_find_session_by_bssid(mac, pNeighborReq->bssId, &sessionId); - if (pe_session == NULL) { + if (!pe_session) { pe_err("session does not exist for given bssId"); return QDF_STATUS_E_FAILURE; } @@ -674,12 +674,12 @@ rrm_fill_beacon_ies(struct mac_context *mac, uint16_t BcnNumIes, total_ies_len; uint8_t rem_len = 0; - if ((pIes == NULL) || (pNumIes == NULL) || (pBssDesc == NULL)) { + if ((!pIes) || (!pNumIes) || (!pBssDesc)) { pe_err("Invalid parameters"); return 0; } /* Make sure that if eid is null, numEids is set to zero. */ - numEids = (eids == NULL) ? 0 : numEids; + numEids = (!eids) ? 0 : numEids; total_ies_len = GET_IE_LEN_IN_BSS(pBssDesc->length); BcnNumIes = total_ies_len; @@ -796,12 +796,12 @@ rrm_process_beacon_report_xmit(struct mac_context *mac_ctx, pe_debug("Received beacon report xmit indication"); - if (NULL == beacon_xmit_ind) { + if (!beacon_xmit_ind) { pe_err("Received beacon_xmit_ind is NULL in PE"); return QDF_STATUS_E_FAILURE; } - if (NULL == curr_req) { + if (!curr_req) { pe_err("Received report xmit while there is no request pending in PE"); status = QDF_STATUS_E_FAILURE; goto end; @@ -814,7 +814,7 @@ rrm_process_beacon_report_xmit(struct mac_context *mac_ctx, session_entry = pe_find_session_by_bssid(mac_ctx, beacon_xmit_ind->bssId, &session_id); - if (NULL == session_entry) { + if (!session_entry) { pe_err("session does not exist for given bssId"); status = QDF_STATUS_E_FAILURE; goto end; @@ -974,7 +974,7 @@ end: rrm_cleanup(mac_ctx); } - if (NULL != report) + if (report) qdf_mem_free(report); return status; @@ -1047,7 +1047,7 @@ QDF_STATUS rrm_process_beacon_req(struct mac_context *mac_ctx, tSirMacAddr peer, tpSirMacRadioMeasureReport report; if (curr_req) { - if (*radiomes_report == NULL) { + if (!*radiomes_report) { /* * Allocate memory to send reports for * any subsequent requests. @@ -1107,7 +1107,7 @@ QDF_STATUS update_rrm_report(struct mac_context *mac_ctx, tDot11fRadioMeasurementRequest *rrm_req, uint8_t *num_report, int index) { - if (report == NULL) { + if (!report) { /* * Allocate memory to send reports for * any subsequent requests. diff --git a/core/mac/src/pe/sch/sch_api.c b/core/mac/src/pe/sch/sch_api.c index dc57ce3ec4..cc7396c848 100644 --- a/core/mac/src/pe/sch/sch_api.c +++ b/core/mac/src/pe/sch/sch_api.c @@ -68,7 +68,7 @@ QDF_STATUS sch_send_beacon_req(struct mac_context *mac, uint8_t *beaconPayload, } beaconParams = qdf_mem_malloc(sizeof(tSendbeaconParams)); - if (NULL == beaconParams) + if (!beaconParams) return QDF_STATUS_E_NOMEM; msgQ.type = WMA_SEND_BEACON_REQ; @@ -134,7 +134,7 @@ QDF_STATUS sch_send_beacon_req(struct mac_context *mac, uint8_t *beaconPayload, pe_session->beacon = NULL; pe_session->beacon = qdf_mem_malloc(size); - if (pe_session->beacon != NULL) { + if (pe_session->beacon) { qdf_mem_copy(pe_session->beacon, beaconPayload, size); pe_session->bcnLen = size; } @@ -164,7 +164,7 @@ static uint32_t lim_remove_p2p_ie_from_add_ie(struct mac_context *mac, qdf_mem_copy(addIeWoP2pIe, ptr, left); *addnIELenWoP2pIe = left; - if (addIeWoP2pIe != NULL) { + if (addIeWoP2pIe) { while (left >= 2) { elem_id = ptr[0]; elem_len = ptr[1]; @@ -226,7 +226,7 @@ uint32_t lim_send_probe_rsp_template_to_hal(struct mac_context *mac, */ addIeWoP2pIe = qdf_mem_malloc(pe_session->add_ie_params. probeRespDataLen); - if (NULL == addIeWoP2pIe) { + if (!addIeWoP2pIe) { pe_err("FAILED to alloc memory when removing P2P IE"); return QDF_STATUS_E_NOMEM; } @@ -241,7 +241,7 @@ uint32_t lim_send_probe_rsp_template_to_hal(struct mac_context *mac, /* Probe rsp IE available */ /*need to check the data length */ addIE = qdf_mem_malloc(addnIELenWoP2pIe); - if (NULL == addIE) { + if (!addIE) { pe_err("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length"); qdf_mem_free(addIeWoP2pIe); return QDF_STATUS_E_NOMEM; @@ -342,7 +342,7 @@ uint32_t lim_send_probe_rsp_template_to_hal(struct mac_context *mac, qdf_mem_free(addIE); pprobeRespParams = qdf_mem_malloc(sizeof(tSendProbeRespParams)); - if (NULL == pprobeRespParams) { + if (!pprobeRespParams) { pe_err("malloc failed for bytes %d", nBytes); } else { sir_copy_mac_addr(pprobeRespParams->bssId, pe_session->bssId); @@ -409,7 +409,7 @@ int sch_gen_timing_advert_frame(struct mac_context *mac_ctx, tSirMacAddr self_ad buf_size = sizeof(tSirMacMgmtHdr) + payload_size; *buf = qdf_mem_malloc(buf_size); - if (*buf == NULL) { + if (!*buf) { pe_err("Cannot allocate memory"); return QDF_STATUS_E_FAILURE; } diff --git a/core/mac/src/pe/sch/sch_beacon_gen.c b/core/mac/src/pe/sch/sch_beacon_gen.c index a21ef53bdd..35bc9f7d43 100644 --- a/core/mac/src/pe/sch/sch_beacon_gen.c +++ b/core/mac/src/pe/sch/sch_beacon_gen.c @@ -138,7 +138,7 @@ sch_append_addn_ie(struct mac_context *mac_ctx, struct pe_session *session, } p2p_ie = (uint8_t *)limGetP2pIEPtr(mac_ctx, &add_ie[0], addn_ielen); - if ((p2p_ie != NULL) && !mac_ctx->beacon_offload) { + if ((p2p_ie) && !mac_ctx->beacon_offload) { /* get NoA attribute stream P2P IE */ noa_len = lim_get_noa_attr_stream(mac_ctx, noa_strm, session); if (noa_len) { @@ -474,7 +474,7 @@ sch_set_fixed_beacon_fields(struct mac_context *mac_ctx, struct pe_session *sess POPULATE_DOT11F_RATES_OPERATIONAL, &bcn_2->ExtSuppRates, session); - if (session->pLimStartBssReq != NULL) { + if (session->pLimStartBssReq) { populate_dot11f_wpa(mac_ctx, &session->pLimStartBssReq->rsnIE, &bcn_2->WPA); populate_dot11f_rsn_opaque(mac_ctx, diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index 7e48962075..ed2a8f866e 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -278,7 +278,7 @@ static void __sch_beacon_process_no_session(struct mac_context *mac, struct pe_session *pe_session = NULL; pe_session = lim_is_ibss_session_active(mac); - if (pe_session != NULL) { + if (pe_session) { lim_handle_ibss_coalescing(mac, pBeacon, pRxPacketInfo, pe_session); } @@ -441,7 +441,7 @@ sch_bcn_process_sta(struct mac_context *mac_ctx, session); if (QDF_IS_STATUS_ERROR(status)) { pe_err("EDCA parameter processing error"); - } else if (sta != NULL) { + } else if (sta) { /* If needed, downgrade the EDCA parameters */ lim_set_active_edca_params(mac_ctx, session->gLimEdcaParams, session); @@ -734,7 +734,7 @@ sch_bcn_process_sta_ibss(struct mac_context *mac_ctx, /* check for VHT capability */ sta = dph_lookup_hash_entry(mac_ctx, pMh->sa, &aid, &session->dph.dphHashTable); - if ((NULL == sta) || ((NULL != sta) && + if ((!sta) || ((sta) && (STA_INVALID_IDX == sta->staIndex))) return; sch_bcn_update_opmode_change(mac_ctx, sta, session, bcn, pMh, @@ -1102,7 +1102,7 @@ sch_beacon_process(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, * Now process the beacon in the context of the BSS which is * transmitting the beacons, if one is found */ - if (session == NULL) + if (!session) __sch_beacon_process_no_session(mac_ctx, &bcn, rx_pkt_info); else __sch_beacon_process_for_session(mac_ctx, &bcn, rx_pkt_info, diff --git a/core/mac/src/pe/sch/sch_message.c b/core/mac/src/pe/sch/sch_message.c index ae81d124d2..02a9806027 100644 --- a/core/mac/src/pe/sch/sch_message.c +++ b/core/mac/src/pe/sch/sch_message.c @@ -223,7 +223,7 @@ broadcast_wmm_of_concurrent_sta_session(struct mac_context *mac_ctx, break; } - if (concurrent_session == NULL) + if (!concurrent_session) return false; if (!qdf_mem_cmp(session->gLimEdcaParamsBC, diff --git a/core/mac/src/sys/common/src/wlan_qct_sys.c b/core/mac/src/sys/common/src/wlan_qct_sys.c index b4cd2c940f..ec2647d8b1 100644 --- a/core/mac/src/sys/common/src/wlan_qct_sys.c +++ b/core/mac/src/sys/common/src/wlan_qct_sys.c @@ -127,7 +127,7 @@ static QDF_STATUS sys_mc_process_msg(struct scheduler_msg *pMsg) data_stall_detect_cb data_stall_detect_callback; mac_handle_t mac_handle; - if (NULL == pMsg) { + if (!pMsg) { QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, "%s: NULL pointer to struct scheduler_msg", __func__); QDF_ASSERT(0); @@ -148,7 +148,7 @@ static QDF_STATUS sys_mc_process_msg(struct scheduler_msg *pMsg) QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, "Processing SYS MC STOP"); mac_handle = cds_get_context(QDF_MODULE_ID_PE); - if (NULL == mac_handle) { + if (!mac_handle) { QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, "%s: Invalid mac_handle", __func__); @@ -164,7 +164,7 @@ static QDF_STATUS sys_mc_process_msg(struct scheduler_msg *pMsg) case SYS_MSG_ID_DATA_STALL_MSG: data_stall_detect_callback = pMsg->callback; - if (NULL != data_stall_detect_callback) + if (data_stall_detect_callback) data_stall_detect_callback(pMsg->bodyptr); qdf_mem_free(pMsg->bodyptr); break; diff --git a/core/mac/src/sys/legacy/src/platform/src/sys_wrapper.c b/core/mac/src/sys/legacy/src/platform/src/sys_wrapper.c index 672721e5e0..fcbb821ea3 100644 --- a/core/mac/src/sys/legacy/src/platform/src/sys_wrapper.c +++ b/core/mac/src/sys/legacy/src/platform/src/sys_wrapper.c @@ -86,12 +86,12 @@ uint32_t tx_timer_activate(TX_TIMER *timer_ptr) /* following anomalous cnditions. */ /* Assert that the timer structure pointer passed, is not NULL */ - /* dbgAssert(NULL != timer_ptr); */ + /* dbgAssert(timer_ptr); */ /* If the NIC is halting just spoof a successful timer activation, so that all */ /* the timers can be cleaned up. */ - if (NULL == timer_ptr) + if (!timer_ptr) return TX_TIMER_ERROR; /* Put a check for the free builds */ @@ -215,12 +215,12 @@ static void tx_main_timer_func(void *functionContext) { TX_TIMER *timer_ptr = (TX_TIMER *) functionContext; - if (NULL == timer_ptr) { + if (!timer_ptr) { QDF_ASSERT(0); return; } - if (NULL == timer_ptr->pExpireFunc) { + if (!timer_ptr->pExpireFunc) { QDF_ASSERT(0); return; } @@ -258,14 +258,14 @@ uint32_t tx_timer_create_intern_debug(void *pMacGlobal, { QDF_STATUS status; - if (NULL == expiration_function) { + if (!expiration_function) { QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, "NULL timer expiration"); QDF_ASSERT(0); return TX_TIMER_ERROR; } - if (NULL == name_ptr) { + if (!name_ptr) { QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, "NULL name pointer for timer"); @@ -329,7 +329,7 @@ uint32_t tx_timer_create_intern(void *pMacGlobal, TX_TIMER *timer_ptr, { QDF_STATUS status; - if ((NULL == name_ptr) || (NULL == expiration_function)) + if ((!name_ptr) || (!expiration_function)) return TX_TIMER_ERROR; if (!initScheduleTimeInTicks) 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 7398d335fe..747d5498b2 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 @@ -523,7 +523,7 @@ populate_dot11f_ext_supp_rates(struct mac_context *mac, uint8_t nChannelNum, sending mgmt frames (lile probe req) which need to go out before any session is present. */ if (POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum) { - if (pe_session != NULL) { + if (pe_session) { nRates = pe_session->extRateSet.numRates; qdf_mem_copy(rates, pe_session->extRateSet.rate, nRates); @@ -615,7 +615,7 @@ populate_dot11f_ht_caps(struct mac_context *mac, pDot11f->lsigTXOPProtection = ht_cap_info->l_sig_tx_op_protection; /* All sessionized entries will need the check below */ - if (pe_session == NULL) { /* Only in case of NO session */ + if (!pe_session) { /* Only in case of NO session */ pDot11f->supportedChannelWidthSet = ht_cap_info->supported_channel_width_set; pDot11f->advCodingCap = ht_cap_info->adv_coding_cap; @@ -1132,7 +1132,7 @@ populate_dot11f_ht_info(struct mac_context *mac, qdf_size_t ncfglen; QDF_STATUS nSirStatus; - if (NULL == pe_session) { + if (!pe_session) { pe_err("Invalid session entry"); return QDF_STATUS_E_FAILURE; } @@ -1479,7 +1479,7 @@ populate_dot11f_supp_rates(struct mac_context *mac, * req) which need to go out before any session is present. */ if (POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum) { - if (pe_session != NULL) { + if (pe_session) { nRates = pe_session->rateSet.numRates; qdf_mem_copy(rates, pe_session->rateSet.rate, nRates); @@ -5373,7 +5373,7 @@ QDF_STATUS populate_dot11_assoc_res_p2p_ie(struct mac_context *mac, p2pIe = limGetP2pIEPtr(mac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length); - if (p2pIe != NULL) { + if (p2pIe) { pDot11f->present = 1; pDot11f->P2PStatus.present = 1; pDot11f->P2PStatus.status = QDF_STATUS_SUCCESS;