diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 93bcdadd8d67..cd0444fe7cc7 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1080,7 +1080,7 @@ hdd_send_ft_assoc_response(struct net_device *dev, assoc_rsp = (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength + roam_info->nAssocReqLength); - if (assoc_rsp == NULL) { + if (!assoc_rsp) { hdd_debug("AssocReq or AssocRsp is NULL"); return; } @@ -1230,7 +1230,7 @@ hdd_send_new_ap_channel_info(struct net_device *dev, union iwreq_data wrqu; struct bss_description *descriptor = roam_info->pBssDesc; - if (descriptor == NULL) { + if (!descriptor) { hdd_err("bss descriptor is null"); return; } @@ -1273,7 +1273,7 @@ hdd_send_update_beacon_ies_event(struct hdd_adapter *adapter, return; } beacon_ies = (u8 *) (roam_info->pbFrames + BEACON_FRAME_IES_OFFSET); - if (beacon_ies == NULL) { + if (!beacon_ies) { hdd_warn("Beacon IEs is NULL"); return; } @@ -1345,7 +1345,7 @@ static void hdd_send_association_event(struct net_device *dev, wrqu.ap_addr.sa_family = ARPHRD_ETHER; we_event = SIOCGIWAP; #ifdef WLAN_FEATURE_ROAM_OFFLOAD - if (NULL != roam_info) + if (roam_info) if (roam_info->roamSynchInProgress) { /* Update tdls module about the disconnection event */ hdd_notify_sta_disconnect(adapter->vdev_id, @@ -1713,7 +1713,7 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, bool sendDisconInd = true; mac_handle_t mac_handle; - if (dev == NULL) { + if (!dev) { hdd_err("net_dev is released return"); return QDF_STATUS_E_FAILURE; } @@ -1925,7 +1925,7 @@ static void hdd_set_peer_authorized_event(uint32_t vdev_id) return; } adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); - if (adapter == NULL) { + if (!adapter) { hdd_err("Invalid vdev_id"); return; } @@ -1967,7 +1967,7 @@ QDF_STATUS hdd_change_peer_state(struct hdd_adapter *adapter, return QDF_STATUS_E_FAULT; peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); - if (peer_mac_addr == NULL) { + if (!peer_mac_addr) { hdd_err("peer mac addr is NULL"); return QDF_STATUS_E_FAULT; } @@ -2057,7 +2057,7 @@ QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, return status; data_vdev = cdp_peer_get_vdev_by_sta_id(soc, pdev, sta_id); - if (NULL == data_vdev) { + if (!data_vdev) { status = QDF_STATUS_E_FAILURE; return status; } @@ -2088,7 +2088,7 @@ QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter, void *soc = cds_get_context(QDF_MODULE_ID_SOC); void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); - if (NULL == pBssDesc) + if (!pBssDesc) return QDF_STATUS_E_FAILURE; /* Get the Station ID from the one saved during the association */ @@ -2323,7 +2323,7 @@ static void hdd_send_re_assoc_event(struct net_device *dev, assoc_rsp = (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength + roam_info->nAssocReqLength); - if (assoc_rsp == NULL) + if (!assoc_rsp) goto done; /* assoc_rsp needs to point to the IEs */ @@ -2368,7 +2368,7 @@ static void hdd_send_re_assoc_event(struct net_device *dev, &roam_profile.SSID.ssId[0], roam_profile.SSID.length); - if (bss == NULL) + if (!bss) hdd_warn("Get BSS returned NULL"); buf_ptr = buf_ssid_ie; *buf_ptr = SIR_MAC_SSID_EID; @@ -2382,7 +2382,7 @@ static void hdd_send_re_assoc_event(struct net_device *dev, QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, buf_ssid_ie, ssid_ie_len); final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); - if (final_req_ie == NULL) { + if (!final_req_ie) { if (bss) cfg80211_put_bss(adapter->wdev.wiphy, bss); goto done; @@ -2645,7 +2645,7 @@ hdd_roam_set_key_complete_handler(struct hdd_adapter *adapter, hdd_enter(); - if (NULL == roam_info) { + if (!roam_info) { hdd_err("roam_info is NULL"); return QDF_STATUS_E_FAILURE; } @@ -2808,7 +2808,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter, mac_handle = hdd_ctx->mac_handle; if (eCSR_ROAM_RESULT_ASSOCIATED == roam_result) { - if (NULL == roam_info) { + if (!roam_info) { hdd_err("roam_info is NULL"); return QDF_STATUS_E_FAILURE; } @@ -2966,7 +2966,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter, bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); - if (NULL == bss) { + if (!bss) { hdd_err("wlan: Not able to create BSS entry"); wlan_hdd_netif_queue_control(adapter, WLAN_NETIF_CARRIER_OFF, @@ -2997,7 +2997,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter, (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength + roam_info->nAssocReqLength); - if (assoc_rsp != NULL) { + if (assoc_rsp) { /* * assoc_rsp needs to point to the IEs */ @@ -3020,7 +3020,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter, /* Association Request */ assoc_req = (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength); - if (assoc_req != NULL) { + if (assoc_req) { if (!ft_carrier_on) { /* * assoc_req needs to point to @@ -3510,7 +3510,7 @@ static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, struct hdd_station_ctx *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - if (NULL == roam_info) { + if (!roam_info) { QDF_ASSERT(0); return; } @@ -3553,7 +3553,7 @@ static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, /* we must first give cfg80211 the BSS information */ bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); - if (NULL == bss) { + if (!bss) { hdd_err("%s: unable to create IBSS entry", adapter->dev->name); return; @@ -3767,7 +3767,7 @@ static QDF_STATUS roam_ibss_connect_handler(struct hdd_adapter *adapter, hdd_send_association_event(adapter->dev, roam_info); /* add bss_id to cfg80211 data base */ bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); - if (NULL == bss) { + if (!bss) { hdd_err("%s: unable to create IBSS entry", adapter->dev->name); return QDF_STATUS_E_FAILURE; @@ -4191,7 +4191,7 @@ hdd_indicate_tsm_ie(struct hdd_adapter *adapter, uint8_t tid, char buf[IW_CUSTOM_MAX + 1]; int nBytes = 0; - if (NULL == adapter) + if (!adapter) return; /* create the event */ @@ -4230,7 +4230,7 @@ hdd_indicate_cckm_pre_auth(struct hdd_adapter *adapter, char *pos = buf; int nBytes = 0, freeBytes = IW_CUSTOM_MAX; - if ((NULL == adapter) || (NULL == roam_info)) + if ((!adapter) || (!roam_info)) return; /* create the event */ @@ -4276,7 +4276,7 @@ hdd_indicate_ese_adj_ap_rep_ind(struct hdd_adapter *adapter, char buf[IW_CUSTOM_MAX + 1]; int nBytes = 0; - if ((NULL == adapter) || (NULL == roam_info)) + if ((!adapter) || (!roam_info)) return; /* create the event */ @@ -4364,7 +4364,7 @@ hdd_indicate_ese_bcn_report_ind(const struct hdd_adapter *adapter, */ #define ESEBCNREPHEADER_LEN (18) - if ((NULL == adapter) || (NULL == roam_info)) + if ((!adapter) || (!roam_info)) return; /* @@ -4613,7 +4613,7 @@ static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter, roam_info->chan_info.band_center_freq2; bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); - if (NULL == bss) + if (!bss) hdd_err("%s: unable to create BSS entry", adapter->dev->name); else cfg80211_put_bss(wiphy, bss); @@ -4658,7 +4658,7 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info, roam_status, roam_result, roam_id); /* Sanity check */ - if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { + if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { hdd_err("Invalid adapter or adapter has invalid magic"); return QDF_STATUS_E_FAILURE; } @@ -4836,7 +4836,7 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info, } } #ifdef WLAN_FEATURE_ROAM_OFFLOAD - if (roam_info != NULL) + if (roam_info) roam_info->roamSynchInProgress = false; #endif break; @@ -4940,10 +4940,10 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info, break; case eCSR_ROAM_UPDATE_SCAN_RESULT: - if ((NULL != roam_info) && (NULL != roam_info->pBssDesc)) { + if ((roam_info) && (roam_info->pBssDesc)) { bss_status = wlan_hdd_inform_bss_frame(adapter, roam_info->pBssDesc); - if (NULL == bss_status) + if (!bss_status) hdd_debug("UPDATE_SCAN_RESULT returned NULL"); else cfg80211_put_bss( diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 9cd4653e2552..c0df522a302b 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -67,7 +67,7 @@ static char *get_next_line(char *str) { char c; - if (str == NULL || *str == '\0') + if (!str || *str == '\0') return NULL; c = *str; @@ -627,7 +627,7 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) temp = qdf_mem_malloc(fw->size + 1); - if (temp == NULL) { + if (!temp) { hdd_err("fail to alloc memory"); qdf_status = QDF_STATUS_E_NOMEM; goto config_exit; @@ -641,7 +641,7 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) * Intf1MacAddress=00AA00BB00CD * END */ - while (buffer != NULL) { + while (buffer) { line = get_next_line(buffer); buffer = i_trim(buffer); @@ -806,7 +806,7 @@ QDF_STATUS hdd_parse_config_ini(struct hdd_context *hdd_ctx) buffer = (char *)qdf_mem_malloc(fw->size); - if (NULL == buffer) { + if (!buffer) { hdd_err("qdf_mem_malloc failure"); qdf_status = QDF_STATUS_E_NOMEM; goto config_exit; @@ -816,7 +816,7 @@ QDF_STATUS hdd_parse_config_ini(struct hdd_context *hdd_ctx) qdf_mem_copy((void *)buffer, (void *)fw->data, fw->size); size = fw->size; - while (buffer != NULL) { + while (buffer) { line = get_next_line(buffer); buffer = i_trim(buffer); @@ -985,13 +985,13 @@ static QDF_STATUS hdd_convert_string_to_array(char *str, uint8_t *array, { char *format, *s = str; - if (str == NULL || array == NULL || len == NULL) + if (!str || !array || !len) return QDF_STATUS_E_INVAL; format = (to_hex) ? "%02x" : "%d"; *len = 0; - while ((s != NULL) && (*len < array_max_len)) { + while ((s) && (*len < array_max_len)) { int val; /* Increment length only if sscanf successfully extracted * one element. Any other return value means error. @@ -1038,7 +1038,7 @@ QDF_STATUS hdd_hex_string_to_u16_array(char *str, char *s = str; uint32_t val = 0; - if (str == NULL || int_array == NULL || len == NULL) + if (!str || !int_array || !len) return QDF_STATUS_E_INVAL; hdd_debug("str %pK intArray %pK intArrayMaxLen %d", @@ -1046,7 +1046,7 @@ QDF_STATUS hdd_hex_string_to_u16_array(char *str, *len = 0; - while ((s != NULL) && (*len < int_array_max_len)) { + while ((s) && (*len < int_array_max_len)) { /* * Increment length only if sscanf successfully extracted one * element. Any other return value means error. Ignore it. @@ -1108,7 +1108,7 @@ QDF_STATUS hdd_set_policy_mgr_user_cfg(struct hdd_context *hdd_ctx) struct policy_mgr_user_cfg *user_cfg; user_cfg = qdf_mem_malloc(sizeof(*user_cfg)); - if (NULL == user_cfg) { + if (!user_cfg) { hdd_err("unable to allocate user_cfg"); return QDF_STATUS_E_NOMEM; } @@ -1309,7 +1309,7 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) } sme_config = qdf_mem_malloc(sizeof(*sme_config)); - if (NULL == sme_config) { + if (!sme_config) { hdd_err("unable to allocate sme_config"); return QDF_STATUS_E_NOMEM; } diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 43fcb8507f51..343f574ab453 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -1543,7 +1543,7 @@ static int __is_driver_dfs_capable(struct wiphy *wiphy, temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + NLMSG_HDRLEN); - if (temp_skbuff != NULL) { + if (temp_skbuff) { ret_val = nla_put_u32(temp_skbuff, QCA_WLAN_VENDOR_ATTR_DFS, dfs_capability); if (ret_val) { @@ -2897,7 +2897,7 @@ out: if (ret == 0) { temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, NLMSG_HDRLEN); - if (temp_skbuff != NULL) + if (temp_skbuff) return cfg80211_vendor_cmd_reply(temp_skbuff); } qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0); @@ -2950,7 +2950,7 @@ static int wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, void wlan_hdd_undo_acs(struct hdd_adapter *adapter) { - if (adapter == NULL) + if (!adapter) return; if (adapter->session.ap.sap_config.acs_cfg.ch_list) { qdf_mem_free(adapter->session.ap.sap_config.acs_cfg.ch_list); @@ -4623,7 +4623,7 @@ static int __wlan_hdd_cfg80211_keymgmt_set_key(struct wiphy *wiphy, return -EPERM; } - if ((data == NULL) || (data_len <= 0) || + if ((!data) || (data_len <= 0) || (data_len > SIR_ROAM_SCAN_PSK_SIZE)) { hdd_err("Invalid data"); return -EINVAL; @@ -8705,7 +8705,7 @@ static int __wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy, reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u8) + sizeof(u8) + sizeof(u32) + NLMSG_HDRLEN); - if (NULL == reply_skb) { + if (!reply_skb) { hdd_err("getLinkProperties: skb alloc failed"); return -EINVAL; } @@ -11068,7 +11068,7 @@ void hdd_update_cca_info_cb(hdd_handle_t hdd_handle, uint32_t congestion, return; adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); - if (adapter == NULL) { + if (!adapter) { hdd_err("vdev_id %d does not exist with host", vdev_id); return; } @@ -11640,14 +11640,14 @@ static int hdd_populate_connectivity_check_stats_info( uint32_t count = 0; connect_stats = nla_nest_start(skb, DATA_PKT_STATS); - if (connect_stats == NULL) { + if (!connect_stats) { hdd_err("nla_nest_start failed"); return -EINVAL; } if (adapter->pkt_type_bitmap & CONNECTIVITY_CHECK_SET_DNS) { connect_info = nla_nest_start(skb, count); - if (connect_info == NULL) { + if (!connect_info) { hdd_err("nla_nest_start failed count %u", count); return -EINVAL; } @@ -11660,7 +11660,7 @@ static int hdd_populate_connectivity_check_stats_info( if (adapter->pkt_type_bitmap & CONNECTIVITY_CHECK_SET_TCP_HANDSHAKE) { connect_info = nla_nest_start(skb, count); - if (connect_info == NULL) { + if (!connect_info) { hdd_err("nla_nest_start failed count %u", count); return -EINVAL; } @@ -11671,7 +11671,7 @@ static int hdd_populate_connectivity_check_stats_info( count++; connect_info = nla_nest_start(skb, count); - if (connect_info == NULL) { + if (!connect_info) { hdd_err("nla_nest_start failed count %u", count); return -EINVAL; } @@ -11682,7 +11682,7 @@ static int hdd_populate_connectivity_check_stats_info( count++; connect_info = nla_nest_start(skb, count); - if (connect_info == NULL) { + if (!connect_info) { hdd_err("nla_nest_start failed count %u", count); return -EINVAL; } @@ -11695,7 +11695,7 @@ static int hdd_populate_connectivity_check_stats_info( if (adapter->pkt_type_bitmap & CONNECTIVITY_CHECK_SET_ICMPV4) { connect_info = nla_nest_start(skb, count); - if (connect_info == NULL) { + if (!connect_info) { hdd_err("nla_nest_start failed count %u", count); return -EINVAL; } @@ -12953,7 +12953,7 @@ int wlan_hdd_cfg80211_update_band(struct hdd_context *hdd_ctx, for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) { - if (NULL == wiphy->bands[i]) + if (!wiphy->bands[i]) continue; for (j = 0; j < wiphy->bands[i]->n_channels; j++) { @@ -13391,7 +13391,7 @@ int wlan_hdd_cfg80211_init(struct device *dev, mem_fail: hdd_err("Not enough memory to allocate channels"); - if (wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels != NULL) { + if (wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels) { qdf_mem_free(wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels); wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels = NULL; } @@ -13414,8 +13414,8 @@ void wlan_hdd_cfg80211_deinit(struct wiphy *wiphy) const uint32_t *cipher_suites; for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) { - if (NULL != wiphy->bands[i] && - (NULL != wiphy->bands[i]->channels)) { + if (wiphy->bands[i] && + (wiphy->bands[i]->channels)) { qdf_mem_free(wiphy->bands[i]->channels); wiphy->bands[i]->channels = NULL; } @@ -13448,10 +13448,10 @@ static void wlan_hdd_update_ht_cap(struct hdd_context *hdd_ctx) hdd_err("could not get HT capability info"); if (ht_cap_info.tx_stbc) { - if (NULL != hdd_ctx->wiphy->bands[HDD_NL80211_BAND_2GHZ]) + if (hdd_ctx->wiphy->bands[HDD_NL80211_BAND_2GHZ]) hdd_ctx->wiphy->bands[HDD_NL80211_BAND_2GHZ]->ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC; - if (NULL != hdd_ctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]) + if (hdd_ctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]) hdd_ctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]->ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC; } @@ -13502,7 +13502,7 @@ static void wlan_hdd_update_band_cap_in_wiphy(struct hdd_context *hdd_ctx) } for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) { - if (NULL == hdd_ctx->wiphy->bands[i]) + if (!hdd_ctx->wiphy->bands[i]) continue; for (j = 0; j < hdd_ctx->wiphy->bands[i]->n_channels; j++) { @@ -15145,7 +15145,7 @@ static int __wlan_hdd_cfg80211_get_key(struct wiphy *wiphy, roam_profile = hdd_roam_profile(adapter); } - if (roam_profile == NULL) { + if (!roam_profile) { hdd_err("Get roam profile failed!"); return -EINVAL; } @@ -15684,12 +15684,12 @@ wlan_hdd_inform_bss_frame(struct hdd_adapter *adapter, } if (bss_desc->channelId <= ARRAY_SIZE(hdd_channels_2_4_ghz) && - (wiphy->bands[HDD_NL80211_BAND_2GHZ] != NULL)) { + (wiphy->bands[HDD_NL80211_BAND_2GHZ])) { freq = ieee80211_channel_to_frequency(bss_desc->channelId, HDD_NL80211_BAND_2GHZ); } else if ((bss_desc->channelId > ARRAY_SIZE(hdd_channels_2_4_ghz)) - && (wiphy->bands[HDD_NL80211_BAND_5GHZ] != NULL)) { + && (wiphy->bands[HDD_NL80211_BAND_5GHZ])) { freq = ieee80211_channel_to_frequency(bss_desc->channelId, HDD_NL80211_BAND_5GHZ); @@ -15756,10 +15756,10 @@ wlan_hdd_cfg80211_update_bss_db(struct hdd_adapter *adapter, sme_roam_get_connect_profile(mac_handle, adapter->vdev_id, &roamProfile); - if (NULL != roamProfile.pBssDesc) { + if (roamProfile.pBssDesc) { bss = wlan_hdd_inform_bss_frame(adapter, roamProfile.pBssDesc); - if (NULL == bss) + if (!bss) hdd_debug("wlan_hdd_inform_bss_frame returned NULL"); sme_roam_free_connect_profile(&roamProfile); @@ -15792,7 +15792,7 @@ int wlan_hdd_cfg80211_pmksa_candidate_notify(struct hdd_adapter *adapter, hdd_enter(); hdd_debug("is going to notify supplicant of:"); - if (NULL == roam_info) { + if (!roam_info) { hdd_err("roam_info is NULL"); return -EINVAL; } @@ -15824,7 +15824,7 @@ wlan_hdd_cfg80211_roam_metrics_preauth(struct hdd_adapter *adapter, hdd_enter(); - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL!"); return QDF_STATUS_E_FAILURE; } @@ -15867,7 +15867,7 @@ wlan_hdd_cfg80211_roam_metrics_preauth_status(struct hdd_adapter *adapter, hdd_enter(); - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL!"); return QDF_STATUS_E_FAILURE; } @@ -15916,7 +15916,7 @@ wlan_hdd_cfg80211_roam_metrics_handover(struct hdd_adapter *adapter, hdd_enter(); - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL!"); return QDF_STATUS_E_FAILURE; } @@ -16074,7 +16074,7 @@ bool wlan_hdd_handle_sap_sta_dfs_conc(struct hdd_adapter *adapter, ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE); /* probably no sap running, no handling required */ - if (ap_adapter == NULL) + if (!ap_adapter) return true; /* @@ -16095,7 +16095,7 @@ bool wlan_hdd_handle_sap_sta_dfs_conc(struct hdd_adapter *adapter, * know what is going to happen better stop sta connection */ hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter); - if (NULL == hdd_ap_ctx) { + if (!hdd_ap_ctx) { hdd_err("AP context not found"); return false; } @@ -18782,7 +18782,7 @@ static int wlan_hdd_cfg80211_set_privacy_ibss(struct hdd_adapter *adapter, qdf_mem_zero(&sta_ctx->ibss_enc_key, sizeof(tCsrRoamSetKey)); sta_ctx->ibss_enc_key_installed = 0; - if (params->ie_len && (NULL != params->ie)) { + if (params->ie_len && (params->ie)) { if (wlan_get_ie_ptr_from_eid(WLAN_EID_RSN, params->ie, params->ie_len)) { sta_ctx->wpa_versions = NL80211_WPA_VERSION_2; @@ -18796,7 +18796,7 @@ static int wlan_hdd_cfg80211_set_privacy_ibss(struct hdd_adapter *adapter, memset(&dot11_wpa_ie, 0, sizeof(dot11_wpa_ie)); ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_WPA, params->ie, params->ie_len); - if (NULL != ie) { + if (ie) { sta_ctx->wpa_versions = NL80211_WPA_VERSION_1; /* Unpack the WPA IE * Skip past the EID byte and length byte @@ -18985,7 +18985,7 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy, roam_profile->cfg_protection = IBSS_CFG_PROTECTION_ENABLE_MASK; /* BSSID is provided by upper layers hence no need to AUTO generate */ - if (NULL != params->bssid) { + if (params->bssid) { if (ucfg_mlme_set_ibss_auto_bssid(hdd_ctx->psoc, 0) == QDF_STATUS_E_FAILURE) { hdd_err("Unable to update MLME IBSS Auto BSSID config"); @@ -20460,7 +20460,7 @@ static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, return -EINVAL; } - if (NULL == params) { + if (!params) { hdd_err("params is Null"); return -EINVAL; } @@ -20473,7 +20473,7 @@ static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter); - if (NULL == hostapd_state) { + if (!hostapd_state) { hdd_err("hostapd_state is Null"); return -EINVAL; } diff --git a/core/hdd/src/wlan_hdd_debugfs.c b/core/hdd/src/wlan_hdd_debugfs.c index d2f5c7555cdb..05e6e16e65b4 100644 --- a/core/hdd/src/wlan_hdd_debugfs.c +++ b/core/hdd/src/wlan_hdd_debugfs.c @@ -514,15 +514,15 @@ QDF_STATUS hdd_debugfs_init(struct hdd_adapter *adapter) adapter->debugfs_phy = debugfs_create_dir(net_dev->name, 0); - if (NULL == adapter->debugfs_phy) + if (!adapter->debugfs_phy) return QDF_STATUS_E_FAILURE; - if (NULL == debugfs_create_file("wow_pattern", 00400 | 00200, + if (!debugfs_create_file("wow_pattern", 00400 | 00200, adapter->debugfs_phy, net_dev, &fops_wowpattern)) return QDF_STATUS_E_FAILURE; - if (NULL == debugfs_create_file("pattern_gen", 00400 | 00200, + if (!debugfs_create_file("pattern_gen", 00400 | 00200, adapter->debugfs_phy, net_dev, &fops_patterngen)) return QDF_STATUS_E_FAILURE; diff --git a/core/hdd/src/wlan_hdd_disa.c b/core/hdd/src/wlan_hdd_disa.c index 8c6d856c4a93..db3f43844834 100644 --- a/core/hdd/src/wlan_hdd_disa.c +++ b/core/hdd/src/wlan_hdd_disa.c @@ -319,7 +319,7 @@ hdd_fill_encrypt_decrypt_params(struct disa_encrypt_decrypt_req_params qdf_mem_malloc(sizeof(uint8_t) * encrypt_decrypt_params->data_len); - if (encrypt_decrypt_params->data == NULL) { + if (!encrypt_decrypt_params->data) { hdd_err("memory allocation failed"); return -ENOMEM; } diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index d2aa231dd424..6fc9f1433121 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -288,7 +288,7 @@ void hdd_hif_close(struct hdd_context *hdd_ctx, void *hif_ctx) return; } - if (hif_ctx == NULL) + if (!hif_ctx) return; cds_set_target_ready(false); @@ -1118,7 +1118,7 @@ int wlan_hdd_bus_resume(void) } hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (NULL == hif_ctx) { + if (!hif_ctx) { hdd_err("Failed to get hif context"); return -EINVAL; } @@ -1197,7 +1197,7 @@ int wlan_hdd_bus_resume_noirq(void) } hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (NULL == hif_ctx) + if (!hif_ctx) return -EINVAL; qdf_status = ucfg_pmo_psoc_clear_target_wake_up(hdd_ctx->psoc); diff --git a/core/hdd/src/wlan_hdd_ext_scan.c b/core/hdd/src/wlan_hdd_ext_scan.c index 1140b7f19d89..64b394eea5c5 100644 --- a/core/hdd/src/wlan_hdd_ext_scan.c +++ b/core/hdd/src/wlan_hdd_ext_scan.c @@ -2335,7 +2335,7 @@ static void hdd_remove_passive_channels(struct wiphy *wiphy, for (i = 0; i < *num_channels; i++) for (j = 0; j < HDD_NUM_NL80211_BANDS; j++) { - if (wiphy->bands[j] == NULL) + if (!wiphy->bands[j]) continue; for (k = 0; k < wiphy->bands[j]->n_channels; k++) { if ((chan_list[i] == diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c index 0b01fd282094..b4feb7373bd8 100644 --- a/core/hdd/src/wlan_hdd_ftm.c +++ b/core/hdd/src/wlan_hdd_ftm.c @@ -133,7 +133,7 @@ static int wlan_hdd_qcmbr_compat_ioctl(struct hdd_adapter *adapter, int ret = 0; qcmbr_data = qdf_mem_malloc(sizeof(*qcmbr_data)); - if (qcmbr_data == NULL) + if (!qcmbr_data) return -ENOMEM; if (copy_from_user(qcmbr_data, ifr->ifr_data, sizeof(*qcmbr_data))) { @@ -172,7 +172,7 @@ static int wlan_hdd_qcmbr_ioctl(struct hdd_adapter *adapter, struct ifreq *ifr) int ret = 0; qcmbr_data = qdf_mem_malloc(sizeof(*qcmbr_data)); - if (qcmbr_data == NULL) + if (!qcmbr_data) return -ENOMEM; if (copy_from_user(qcmbr_data, ifr->ifr_data, sizeof(*qcmbr_data))) { diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 9ebb6d442f5e..c9bbd9310d17 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1752,7 +1752,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event, adapter = netdev_priv(dev); - if ((NULL == adapter) || + if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { hdd_err("invalid adapter or adapter has invalid magic"); return QDF_STATUS_E_FAILURE; @@ -2708,7 +2708,7 @@ static int hdd_softap_unpack_ie(mac_handle_t mac_handle, tDot11fIERSN dot11_rsn_ie = {0}; tDot11fIEWPA dot11_wpa_ie = {0}; - if (NULL == mac_handle) { + if (!mac_handle) { hdd_err("Error haHandle returned NULL"); return -EINVAL; } @@ -3086,7 +3086,7 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart( return QDF_STATUS_E_FAILURE; } - if (NULL == channel || NULL == sec_ch) { + if (!channel || !sec_ch) { hdd_err("Null parameters"); return QDF_STATUS_E_FAILURE; } @@ -3549,7 +3549,7 @@ int wlan_hdd_set_channel(struct wiphy *wiphy, hdd_enter(); - if (NULL == dev) { + if (!dev) { hdd_err("Called with dev = NULL"); return -ENODEV; } @@ -3799,7 +3799,7 @@ static void wlan_hdd_add_hostapd_conf_vsie(struct hdd_adapter *adapter, uint16_t ielen = 0; bool skip_ie; - if (NULL == ptr || 0 == left) + if (!ptr || 0 == left) return; while (left >= 2) { @@ -3866,7 +3866,7 @@ static void wlan_hdd_add_extra_ie(struct hdd_adapter *adapter, uint8_t elem_id, elem_len; uint16_t ielen = 0; - if (NULL == ptr || 0 == left) + if (!ptr || 0 == left) return; while (left >= 2) { @@ -3967,7 +3967,7 @@ wlan_hdd_cfg80211_alloc_new_beacon(struct hdd_adapter *adapter, beacon = qdf_mem_malloc(size); - if (beacon == NULL) { + if (!beacon) { hdd_err("Mem allocation for beacon failed"); return -ENOMEM; } @@ -4086,7 +4086,7 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter) genie = qdf_mem_malloc(MAX_GENIE_LEN); - if (genie == NULL) + if (!genie) return -ENOMEM; mac_handle = adapter->hdd_ctx->mac_handle; @@ -4148,7 +4148,7 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter) /* Added for Probe Response IE */ proberesp_ies = qdf_mem_malloc(beacon->proberesp_ies_len + MAX_GENIE_LEN); - if (proberesp_ies == NULL) { + if (!proberesp_ies) { hdd_err("mem alloc failed for probe resp ies, size: %d", beacon->proberesp_ies_len + MAX_GENIE_LEN); ret = -EINVAL; @@ -4231,7 +4231,7 @@ static void wlan_hdd_set_sap_hwmode(struct hdd_adapter *adapter) ie = wlan_get_ie_ptr_from_eid(WLAN_EID_SUPP_RATES, &mgmt_frame->u.beacon.variable[0], beacon->head_len); - if (ie != NULL) { + if (ie) { ie += 1; wlan_hdd_check_11gmode(ie, &require_ht, &require_vht, &checkRatesfor11g, &config->SapHw_mode); @@ -4239,7 +4239,7 @@ static void wlan_hdd_set_sap_hwmode(struct hdd_adapter *adapter) ie = wlan_get_ie_ptr_from_eid(WLAN_EID_EXT_SUPP_RATES, beacon->tail, beacon->tail_len); - if (ie != NULL) { + if (ie) { ie += 1; wlan_hdd_check_11gmode(ie, &require_ht, &require_vht, &checkRatesfor11g, &config->SapHw_mode); @@ -5361,7 +5361,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, config->SSIDinfo.ssidHidden = false; - if (ssid != NULL) { + if (ssid) { qdf_mem_copy(config->SSIDinfo.ssid.ssId, ssid, ssid_len); config->SSIDinfo.ssid.length = ssid_len; diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index a50df9f5fee6..c942b7b86ae6 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -1587,7 +1587,7 @@ static __iw_softap_set_max_tx_power(struct net_device *dev, hdd_enter_dev(dev); - if (NULL == value) + if (!value) return -ENOMEM; hdd_ctx = WLAN_HDD_GET_CTX(adapter); diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index e41a9fb43b6d..d94fddd75722 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -201,7 +201,7 @@ static int hdd_get_tsm_stats(struct hdd_adapter *adapter, .timeout_ms = WLAN_WAIT_TIME_STATS, }; - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL"); return -EINVAL; } @@ -260,14 +260,14 @@ hdd_get_ibss_peer_info_cb(void *context, struct hdd_station_ctx *sta_ctx; uint8_t i; - if ((NULL == adapter) || + if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { hdd_err("invalid adapter or adapter has invalid magic"); return; } sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - if (NULL != peer_info && QDF_STATUS_SUCCESS == peer_info->status) { + if (peer_info && QDF_STATUS_SUCCESS == peer_info->status) { /* validate number of peers */ if (peer_info->numPeers > SIR_MAX_NUM_STA_IN_IBSS) { hdd_warn("Limiting num_peers %u to %u", @@ -379,7 +379,7 @@ hdd_parse_get_ibss_peer_info(uint8_t *command, in_ptr = strnchr(command, in_ptr_len, SPACE_ASCII_VALUE); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; else if (SPACE_ASCII_VALUE != *in_ptr) return QDF_STATUS_E_FAILURE; @@ -461,7 +461,7 @@ static int _hdd_parse_bssid_and_chan(const uint8_t **data, in_ptr = strnchr(in_ptr, strlen(in_ptr), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) + if (!in_ptr) goto error; /* no space after the command */ else if (SPACE_ASCII_VALUE != *in_ptr) @@ -498,7 +498,7 @@ static int _hdd_parse_bssid_and_chan(const uint8_t **data, /* point to the next argument */ in_ptr = strnchr(in_ptr, strlen(in_ptr), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) + if (!in_ptr) goto error; /* remove empty spaces */ @@ -563,7 +563,7 @@ hdd_parse_send_action_frame_v1_data(const uint8_t *command, /* point to the next argument */ in_ptr = strnchr(in_ptr, strlen(in_ptr), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) + if (!in_ptr) return -EINVAL; /* removing empty spaces */ while ((SPACE_ASCII_VALUE == *in_ptr) && ('\0' != *in_ptr)) @@ -587,7 +587,7 @@ hdd_parse_send_action_frame_v1_data(const uint8_t *command, /* point to the next argument */ in_ptr = strnchr(in_ptr, strlen(in_ptr), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) + if (!in_ptr) return -EINVAL; /* removing empty spaces */ while ((SPACE_ASCII_VALUE == *in_ptr) && ('\0' != *in_ptr)) @@ -616,7 +616,7 @@ hdd_parse_send_action_frame_v1_data(const uint8_t *command, * If N = 19, then we need 10 bytes, hence (19 + 1)/2 = 10 bytes */ *buf = qdf_mem_malloc((*buf_len + 1) / 2); - if (NULL == *buf) { + if (!*buf) { hdd_err("qdf_mem_malloc failed"); return -ENOMEM; } @@ -701,7 +701,7 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, int ret = 0; QDF_STATUS status; - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("Invalid hdd ctx"); return -EINVAL; } @@ -1217,7 +1217,7 @@ hdd_parse_channellist(const uint8_t *command, uint8_t *channel_list, in_ptr = strnchr(command, strlen(command), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) + if (!in_ptr) return -EINVAL; else if (SPACE_ASCII_VALUE != *in_ptr) /* no space after the command */ return -EINVAL; @@ -1251,7 +1251,7 @@ hdd_parse_channellist(const uint8_t *command, uint8_t *channel_list, */ in_ptr = strpbrk(in_ptr, " "); /* no channel list after the number of channels argument */ - if (NULL == in_ptr) { + if (!in_ptr) { if (0 != j) { *num_channels = j; return 0; @@ -1512,7 +1512,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, /* move to argument list */ in_ptr = strnchr(command, strlen(command), SPACE_ASCII_VALUE); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* no space after the command */ @@ -1535,7 +1535,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, req->enable = content; in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1555,7 +1555,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, hdd_debug("diag token %d", req->diag_token); in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1579,7 +1579,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1602,7 +1602,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, hdd_debug("num bursts %d", req->num_bursts); in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1625,7 +1625,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, hdd_debug("burst int %d", req->burst_int); in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1648,7 +1648,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, hdd_debug("meas duration %d", req->meas_duration); in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1671,7 +1671,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, hdd_debug("burst len %d", req->burst_len); in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1696,7 +1696,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, for (count = 0; count < QDF_MAC_ADDR_SIZE; count++) { in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1720,7 +1720,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -1747,7 +1747,7 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, for (count = 0; count < req->plm_num_ch; count++) { in_ptr = strpbrk(in_ptr, " "); - if (NULL == in_ptr) + if (!in_ptr) return QDF_STATUS_E_FAILURE; /* remove empty spaces */ @@ -2104,7 +2104,7 @@ static int hdd_parse_setmaxtxpower_command(uint8_t *command, int *tx_power) in_ptr = strnchr(command, strlen(command), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) + if (!in_ptr) return -EINVAL; else if (SPACE_ASCII_VALUE != *in_ptr) /* no space after the command */ return -EINVAL; @@ -2383,13 +2383,13 @@ static void hdd_tx_fail_ind_callback(uint8_t *macaddr, uint8_t seq_no) payload_len = ETH_ALEN; - if (0 == cesium_pid || cesium_nl_srv_sock == NULL) { + if (0 == cesium_pid || !cesium_nl_srv_sock) { hdd_err("cesium process not registered"); return; } skb = nlmsg_new(payload_len, GFP_ATOMIC); - if (skb == NULL) { + if (!skb) { hdd_err("nlmsg_new() failed for msg size[%d]", NLMSG_SPACE(payload_len)); return; @@ -2397,7 +2397,7 @@ static void hdd_tx_fail_ind_callback(uint8_t *macaddr, uint8_t seq_no) nlh = nlmsg_put(skb, cesium_pid, seq_no, 0, payload_len, NLM_F_REQUEST); - if (NULL == nlh) { + if (!nlh) { hdd_err("nlmsg_put() failed for msg size[%d]", NLMSG_SPACE(payload_len)); @@ -2472,7 +2472,7 @@ static int hdd_parse_ibsstx_fail_event_params(uint8_t *command, ret = hdd_parse_user_params(command, ¶m); - if (0 == ret && NULL != param) { + if (0 == ret && param) { if (1 != sscanf(param, "%hhu", tx_fail_count)) { ret = -EINVAL; goto done; @@ -2534,7 +2534,7 @@ static int hdd_parse_ese_beacon_req(uint8_t *command, char buf[32]; in_ptr = strnchr(command, strlen(command), SPACE_ASCII_VALUE); - if (NULL == in_ptr) /* no argument after the command */ + if (!in_ptr) /* no argument after the command */ return -EINVAL; else if (SPACE_ASCII_VALUE != *in_ptr) /* no space after the command */ return -EINVAL; @@ -2569,7 +2569,7 @@ static int hdd_parse_ese_beacon_req(uint8_t *command, */ in_ptr = strpbrk(in_ptr, " "); /* no ie data after the number of ie fields argument */ - if (NULL == in_ptr) + if (!in_ptr) return -EINVAL; /* remove empty space */ @@ -2675,7 +2675,7 @@ static int hdd_parse_get_cckm_ie(uint8_t *command, uint8_t **cckm_ie, in_ptr = strnchr(command, strlen(command), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) + if (!in_ptr) return -EINVAL; else if (SPACE_ASCII_VALUE != *in_ptr) /* no space after the command */ return -EINVAL; @@ -2705,7 +2705,7 @@ static int hdd_parse_get_cckm_ie(uint8_t *command, uint8_t **cckm_ie, * If N = 19, then we need 10 bytes, hence (19 + 1) / 2 = 10 bytes */ *cckm_ie = qdf_mem_malloc((*cckm_ie_len + 1) / 2); - if (NULL == *cckm_ie) { + if (!*cckm_ie) { hdd_err("qdf_mem_malloc failed"); return -ENOMEM; } @@ -2732,7 +2732,7 @@ int wlan_hdd_set_mc_rate(struct hdd_adapter *adapter, int target_rate) struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); bool bval = false; - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("HDD context is null"); return -EINVAL; } @@ -4767,7 +4767,7 @@ static int hdd_parse_setrmcenable_command(uint8_t *command, in_ptr = strnchr(command, strlen(command), SPACE_ASCII_VALUE); - if (NULL == in_ptr) + if (!in_ptr) return 0; else if (SPACE_ASCII_VALUE != *in_ptr) return 0; @@ -4805,7 +4805,7 @@ static int hdd_parse_setrmcactionperiod_command(uint8_t *pvalue, inptr = strnchr(pvalue, strlen(pvalue), SPACE_ASCII_VALUE); - if (NULL == inptr) + if (!inptr) return -EINVAL; else if (SPACE_ASCII_VALUE != *inptr) return -EINVAL; @@ -4848,7 +4848,7 @@ static int hdd_parse_setrmcrate_command(uint8_t *command, in_ptr = strnchr(command, strlen(command), SPACE_ASCII_VALUE); - if (NULL == in_ptr) + if (!in_ptr) return -EINVAL; else if (SPACE_ASCII_VALUE != *in_ptr) return -EINVAL; @@ -5100,7 +5100,7 @@ static int drv_cmd_get_ibss_peer_info_all(struct hdd_adapter *adapter, */ extra = qdf_mem_malloc(user_size); - if (NULL == extra) { + if (!extra) { hdd_err("memory allocation failed"); ret = -ENOMEM; goto exit; @@ -5500,7 +5500,7 @@ static int drv_cmd_set_cckm_ie(struct hdd_adapter *adapter, if (cckm_ie_len > DOT11F_IE_RSN_MAX_LEN) { hdd_err("CCKM Ie input length is more than max[%d]", DOT11F_IE_RSN_MAX_LEN); - if (NULL != cckm_ie) { + if (cckm_ie) { qdf_mem_free(cckm_ie); cckm_ie = NULL; } @@ -5510,7 +5510,7 @@ static int drv_cmd_set_cckm_ie(struct hdd_adapter *adapter, sme_set_cckm_ie(hdd_ctx->mac_handle, adapter->vdev_id, cckm_ie, cckm_ie_len); - if (NULL != cckm_ie) { + if (cckm_ie) { qdf_mem_free(cckm_ie); cckm_ie = NULL; } @@ -6165,7 +6165,7 @@ static int hdd_set_rx_filter(struct hdd_adapter *adapter, bool action, filter = qdf_mem_malloc(sizeof(*filter)); - if (NULL == filter) { + if (!filter) { hdd_err("Could not allocate Memory"); return -ENOMEM; } @@ -6314,7 +6314,7 @@ static int hdd_parse_setantennamode_command(const uint8_t *value) in_ptr = strnchr(value, strlen(value), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) { + if (!in_ptr) { hdd_err("No argument after the command"); return -EINVAL; } @@ -6843,7 +6843,7 @@ static int hdd_parse_set_channel_switch_command(uint8_t *value, in_ptr = strnchr(value, strlen(value), SPACE_ASCII_VALUE); /* no argument after the command */ - if (NULL == in_ptr) { + if (!in_ptr) { hdd_err("No argument after the command"); return -EINVAL; } @@ -7014,14 +7014,14 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr) uint32_t parsed_channels[MAX_CHANNEL]; bool is_command_repeated = false; - if (NULL == hdd_ctx) { + if (!hdd_ctx) { hdd_err("HDD Context is NULL"); return -EINVAL; } param = strnchr(ptr, strlen(ptr), ' '); /*no argument after the command*/ - if (NULL == param) + if (!param) return -EINVAL; /*no space after the command*/ @@ -7085,7 +7085,7 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr) */ param = strpbrk(param, " "); /*no channel list after the number of channels argument*/ - if (NULL == param) { + if (!param) { hdd_err("Invalid No of channel provided in the list"); ret = -EINVAL; goto parse_failed; @@ -7121,7 +7121,7 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr) /*extra arguments check*/ param = strpbrk(param, " "); - if (NULL != param) { + if (param) { while ((SPACE_ASCII_VALUE == *param) && ('\0' != *param)) param++; diff --git a/core/hdd/src/wlan_hdd_lro.c b/core/hdd/src/wlan_hdd_lro.c index 6acccbf44c91..4b9ed69f646c 100644 --- a/core/hdd/src/wlan_hdd_lro.c +++ b/core/hdd/src/wlan_hdd_lro.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-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 @@ -48,7 +48,7 @@ static qdf_lro_ctx_t wlan_hdd_get_lro_ctx(struct sk_buff *skb) { struct hif_opaque_softc *hif_hdl = (struct hif_opaque_softc *)cds_get_context(QDF_MODULE_ID_HIF); - if (hif_hdl == NULL) { + if (!hif_hdl) { hdd_err("hif_hdl is NULL"); return NULL; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index c5a73b1a09aa..411040e91fd7 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1164,7 +1164,7 @@ QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter) { struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("HDD context is null"); return QDF_STATUS_E_FAILURE; } @@ -2440,10 +2440,10 @@ hdd_update_cds_ac_specs_params(struct hdd_context *hdd_ctx) int i; struct cds_context *cds_ctx; - if (NULL == hdd_ctx) + if (!hdd_ctx) return; - if (NULL == hdd_ctx->config) { + if (!hdd_ctx->config) { /* Do nothing if hdd_ctx is invalid */ hdd_err("%s: Warning: hdd_ctx->cfg_ini is NULL", __func__); return; @@ -3365,7 +3365,7 @@ static int hdd_open_cesium_nl_sock(void) NULL, NULL, THIS_MODULE); #endif - if (cesium_nl_srv_sock == NULL) { + if (!cesium_nl_srv_sock) { hdd_err("NLINK: cesium netlink_kernel_create failed"); ret = -ECONNREFUSED; } @@ -3375,7 +3375,7 @@ static int hdd_open_cesium_nl_sock(void) static void hdd_close_cesium_nl_sock(void) { - if (NULL != cesium_nl_srv_sock) { + if (cesium_nl_srv_sock) { netlink_kernel_release(cesium_nl_srv_sock); cesium_nl_srv_sock = NULL; } @@ -3911,7 +3911,7 @@ QDF_STATUS hdd_sme_open_session_callback(uint8_t vdev_id, } adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); - if (NULL == adapter) { + if (!adapter) { hdd_err("NULL adapter for %d", vdev_id); return QDF_STATUS_E_INVAL; } @@ -3937,7 +3937,7 @@ QDF_STATUS hdd_sme_close_session_callback(uint8_t vdev_id) } adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); - if (NULL == adapter) { + if (!adapter) { hdd_err("NULL adapter"); return QDF_STATUS_E_INVAL; } @@ -5074,7 +5074,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio name_assign_type, iface_name); - if (NULL == adapter) { + if (!adapter) { hdd_err("failed to allocate adapter for session %d", session_type); return NULL; @@ -5130,7 +5130,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio adapter = hdd_wlan_create_ap_dev(hdd_ctx, mac_addr, name_assign_type, (uint8_t *) iface_name); - if (NULL == adapter) { + if (!adapter) { hdd_err("failed to allocate adapter for session %d", session_type); return NULL; @@ -5171,7 +5171,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio adapter = hdd_alloc_station_adapter(hdd_ctx, mac_addr, name_assign_type, iface_name); - if (NULL == adapter) { + if (!adapter) { hdd_err("Failed to allocate adapter for FTM mode"); return NULL; } @@ -5206,7 +5206,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio } if (QDF_STATUS_SUCCESS != status) { - if (NULL != adapter) { + if (adapter) { hdd_cleanup_adapter(hdd_ctx, adapter, rtnl_held); adapter = NULL; } @@ -6167,7 +6167,7 @@ void hdd_update_hlp_info(struct net_device *dev, /* Calculate skb length */ skb_len = (2 * ETH_ALEN) + hlp_data_len; skb = qdf_nbuf_alloc(NULL, skb_len, 0, 4, false); - if (skb == NULL) { + if (!skb) { hdd_err("HLP packet nbuf alloc fails"); return; } @@ -8056,7 +8056,7 @@ static int wlan_hdd_init_tx_rx_histogram(struct hdd_context *hdd_ctx) */ void wlan_hdd_deinit_tx_rx_histogram(struct hdd_context *hdd_ctx) { - if (!hdd_ctx || hdd_ctx->hdd_txrx_hist == NULL) + if (!hdd_ctx || !hdd_ctx->hdd_txrx_hist) return; qdf_mem_free(hdd_ctx->hdd_txrx_hist); @@ -8958,7 +8958,7 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind) } } else if (SME_SESSION_ID_BROADCAST == frame_ind->sessionId) { hdd_for_each_adapter(hdd_ctx, adapter) { - if ((NULL != adapter) && + if ((adapter) && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic)) { __hdd_indicate_mgmt_frame(adapter, frame_ind->frame_len, @@ -8975,7 +8975,7 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind) frame_ind->sessionId); } - if ((NULL != adapter) && + if ((adapter) && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic)) __hdd_indicate_mgmt_frame(adapter, frame_ind->frame_len, @@ -10522,7 +10522,7 @@ static void wlan_hdd_p2p_lo_event_callback(void *context, hdd_enter(); - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("Invalid HDD context pointer"); return; } @@ -12028,7 +12028,7 @@ void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context) } adapter = hdd_get_adapter_by_vdev(hdd_ctx, rsp->vdev_id); - if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { + if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { hdd_err("Invalid adapter or adapter has invalid magic"); osif_request_put(request); return; @@ -12382,7 +12382,7 @@ void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len) skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), flags); - if (skb == NULL) + if (!skb) return; nlh = (struct nlmsghdr *)skb->data; @@ -12656,7 +12656,7 @@ void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter) QDF_STATUS qdf_status; struct hdd_context *hdd_ctx; - if (NULL == ap_adapter) { + if (!ap_adapter) { hdd_err("ap_adapter is NULL here"); return; } @@ -12712,7 +12712,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit) struct hdd_context *hdd_ctx; tsap_config_t *sap_config; - if (NULL == ap_adapter) { + if (!ap_adapter) { hdd_err("ap_adapter is NULL here"); return; } diff --git a/core/hdd/src/wlan_hdd_memdump.c b/core/hdd/src/wlan_hdd_memdump.c index a208821f14d0..7399a73513a1 100644 --- a/core/hdd/src/wlan_hdd_memdump.c +++ b/core/hdd/src/wlan_hdd_memdump.c @@ -231,7 +231,7 @@ static const struct file_operations driver_dump_fops = { static int hdd_driver_memdump_procfs_init(struct hdd_context *hdd_ctx) { proc_dir_driver = proc_mkdir(PROCFS_DRIVER_DUMP_DIR, NULL); - if (proc_dir_driver == NULL) { + if (!proc_dir_driver) { pr_debug("Could not initialize /proc/%s\n", PROCFS_DRIVER_DUMP_DIR); return -ENOMEM; @@ -240,7 +240,7 @@ static int hdd_driver_memdump_procfs_init(struct hdd_context *hdd_ctx) proc_file_driver = proc_create_data(PROCFS_DRIVER_DUMP_NAME, PROCFS_DRIVER_DUMP_PERM, proc_dir_driver, &driver_dump_fops, hdd_ctx); - if (proc_file_driver == NULL) { + if (!proc_file_driver) { remove_proc_entry(PROCFS_DRIVER_DUMP_NAME, proc_dir_driver); pr_debug("Could not initialize /proc/%s\n", PROCFS_DRIVER_DUMP_NAME); diff --git a/core/hdd/src/wlan_hdd_napi.c b/core/hdd/src/wlan_hdd_napi.c index 7fe535da77b5..689f978f4b23 100644 --- a/core/hdd/src/wlan_hdd_napi.c +++ b/core/hdd/src/wlan_hdd_napi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-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 @@ -50,8 +50,8 @@ struct qca_napi_data *hdd_napi_get_all(void) NAPI_DEBUG("-->"); hif = cds_get_context(QDF_MODULE_ID_HIF); - if (unlikely(NULL == hif)) - QDF_ASSERT(NULL != hif); /* WARN */ + if (unlikely(!hif)) + QDF_ASSERT(hif); /* WARN */ else rp = hif_napi_get_all(hif); @@ -71,9 +71,9 @@ static uint32_t hdd_napi_get_map(void) NAPI_DEBUG("-->"); /* cache once, use forever */ - if (hdd_napi_ctx == NULL) + if (!hdd_napi_ctx) hdd_napi_ctx = hdd_napi_get_all(); - if (hdd_napi_ctx != NULL) + if (hdd_napi_ctx) map = hdd_napi_ctx->ce_map; NAPI_DEBUG("<-- [map=0x%08x]", map); @@ -102,15 +102,15 @@ int hdd_napi_create(void) NAPI_DEBUG("-->"); - if (NULL == napid) { + if (!napid) { hdd_err("unable to retrieve napi structure"); rc = -EFAULT; goto exit; } hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (unlikely(NULL == hif_ctx)) { - QDF_ASSERT(NULL != hif_ctx); + if (unlikely(!hif_ctx)) { + QDF_ASSERT(hif_ctx); rc = -EFAULT; goto exit; } @@ -131,7 +131,7 @@ int hdd_napi_create(void) hdd_debug("napi instances were created. Map=0x%x", rc); hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - if (unlikely(NULL == hdd_ctx)) { + if (unlikely(!hdd_ctx)) { QDF_ASSERT(0); rc = -EFAULT; goto exit; @@ -169,8 +169,8 @@ int hdd_napi_destroy(int force) struct hif_opaque_softc *hif_ctx; hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (unlikely(NULL == hif_ctx)) - QDF_ASSERT(NULL != hif_ctx); + if (unlikely(!hif_ctx)) + QDF_ASSERT(hif_ctx); else for (i = 0; i < CE_COUNT_MAX; i++) if (hdd_napi_map & (0x01 << i)) { @@ -189,8 +189,8 @@ int hdd_napi_destroy(int force) hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (unlikely(NULL == hif_ctx)) - QDF_ASSERT(NULL != hif_ctx); + if (unlikely(!hif_ctx)) + QDF_ASSERT(hif_ctx); else rc = hif_napi_cpu_deinit(hif_ctx); } @@ -222,8 +222,8 @@ int hdd_napi_enabled(int id) int rc = 0; /* NOT enabled */ hif = cds_get_context(QDF_MODULE_ID_HIF); - if (unlikely(NULL == hif)) - QDF_ASSERT(hif != NULL); /* WARN_ON; rc = 0 */ + if (unlikely(!hif)) + QDF_ASSERT(hif); /* WARN_ON; rc = 0 */ else if (-1 == id) rc = hif_napi_enabled(hif, id); else @@ -251,8 +251,8 @@ int hdd_napi_event(enum qca_napi_event event, void *data) NAPI_DEBUG("-->(event=%d, aux=%pK)", event, data); hif = cds_get_context(QDF_MODULE_ID_HIF); - if (unlikely(NULL == hif)) - QDF_ASSERT(hif != NULL); + if (unlikely(!hif)) + QDF_ASSERT(hif); else rc = hif_napi_event(hif, event, data); @@ -288,7 +288,7 @@ static int hdd_napi_perfd_cpufreq(enum qca_napi_tput_state req_state) NAPI_DEBUG("-> (%d)", req_state); hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - if (unlikely(hdd_ctx == NULL)) { + if (unlikely(!hdd_ctx)) { hdd_err("cannot get hdd_context"); rc = -EFAULT; goto hnpc_ret; @@ -432,7 +432,7 @@ int hdd_napi_serialize(int is_on) /* make sure that bus_bandwidth trigger is executed */ hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - if (hdd_ctx != NULL) + if (hdd_ctx) hdd_ctx->cur_vote_level = -1; } @@ -480,7 +480,7 @@ int hdd_display_napi_stats(void) char buf[6 * QCA_NAPI_NUM_BUCKETS + 1] = {'\0'}; napid = hdd_napi_get_all(); - if (NULL == napid) { + if (!napid) { hdd_err("%s unable to retrieve napi structure", __func__); return -EFAULT; } @@ -539,7 +539,7 @@ int hdd_clear_napi_stats(void) struct qca_napi_stat *napis; napid = hdd_napi_get_all(); - if (NULL == napid) { + if (!napid) { hdd_err("%s unable to retrieve napi structure", __func__); return -EFAULT; } diff --git a/core/hdd/src/wlan_hdd_object_manager.c b/core/hdd/src/wlan_hdd_object_manager.c index 0bc59c3a923e..cc6139fa4ed5 100644 --- a/core/hdd/src/wlan_hdd_object_manager.c +++ b/core/hdd/src/wlan_hdd_object_manager.c @@ -160,7 +160,7 @@ int hdd_objmgr_create_and_store_pdev(struct hdd_context *hdd_ctx) } priv = qdf_mem_malloc(sizeof(*priv)); - if (priv == NULL) { + if (!priv) { hdd_err("pdev os obj create failed"); return -ENOMEM; } diff --git a/core/hdd/src/wlan_hdd_ocb.c b/core/hdd/src/wlan_hdd_ocb.c index 23daebfb0ada..5e2896a425cf 100644 --- a/core/hdd/src/wlan_hdd_ocb.c +++ b/core/hdd/src/wlan_hdd_ocb.c @@ -483,7 +483,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev, /* Scheduled slots same as num channels for compatibility */ config = hdd_ocb_config_new(sched->num_channels, sched->num_channels, 0, 0); - if (config == NULL) { + if (!config) { hdd_err("Failed to allocate memory!"); return -ENOMEM; } @@ -527,7 +527,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev, } else { mac_addr = wlan_hdd_get_intf_addr(hdd_ctx, adapter->device_mode); - if (mac_addr == NULL) { + if (!mac_addr) { hdd_err("Cannot obtain mac address"); rc = -EINVAL; goto fail; @@ -834,7 +834,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy, config = hdd_ocb_config_new(channel_count, schedule_size, ndl_chan_list_len, ndl_active_state_list_len); - if (config == NULL) { + if (!config) { hdd_err("Failed to allocate memory!"); return -ENOMEM; } @@ -878,7 +878,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy, } else { mac_addr = wlan_hdd_get_intf_addr(hdd_ctx, adapter->device_mode); - if (mac_addr == NULL) { + if (!mac_addr) { hdd_err("Cannot obtain mac address"); goto fail; } diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index dff15fa51a61..9a3a5e90a0a4 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -77,7 +77,7 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter, } chan_list = qdf_mem_malloc(sizeof(uint8_t) * OEM_CAP_MAX_NUM_CHANNELS); - if (NULL == chan_list) { + if (!chan_list) { hdd_err("Memory allocation failed"); return -ENOMEM; } @@ -194,7 +194,7 @@ static void send_oem_reg_rsp_nlink_msg(void) } skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL); - if (skb == NULL) + if (!skb) return; nlh = (struct nlmsghdr *)skb->data; @@ -256,7 +256,7 @@ static void send_oem_err_rsp_nlink_msg(int32_t app_pid, uint8_t error_code) uint8_t *buf; skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL); - if (skb == NULL) + if (!skb) return; nlh = (struct nlmsghdr *)skb->data; @@ -311,7 +311,7 @@ void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_data_rsp) skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + OEM_DATA_RSP_SIZE), GFP_KERNEL); - if (skb == NULL) + if (!skb) return; nlh = (struct nlmsghdr *)skb->data; @@ -463,7 +463,7 @@ static int oem_process_channel_info_req_msg(int numOfChannels, char *chanList) skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + sizeof(uint8_t) + numOfChannels * sizeof(*pHddChanInfo)), GFP_KERNEL); - if (skb == NULL) + if (!skb) return -ENOMEM; nlh = (struct nlmsghdr *)skb->data; @@ -573,7 +573,7 @@ static int oem_process_set_cap_req_msg(int oem_cap_len, error_code = qdf_status_to_os_return(status); skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL); - if (skb == NULL) + if (!skb) return -ENOMEM; nlh = (struct nlmsghdr *)skb->data; @@ -633,7 +633,7 @@ static int oem_process_get_cap_req_msg(void) skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + sizeof(*cap_rsp)), GFP_KERNEL); - if (skb == NULL) + if (!skb) return -ENOMEM; nlh = (struct nlmsghdr *)skb->data; @@ -691,7 +691,7 @@ void hdd_send_peer_status_ind_to_oem_app(struct qdf_mac_addr *peer_mac, skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + sizeof(*peer_info)), GFP_KERNEL); - if (skb == NULL) + if (!skb) return; nlh = (struct nlmsghdr *)skb->data; diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 5345937d48d1..e7bda7b78912 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -394,7 +394,7 @@ int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command) int ret; param = strnchr(command, strlen(command), ' '); - if (param == NULL) { + if (!param) { hdd_err("strnchr failed to find delimeter"); return -EINVAL; } @@ -471,7 +471,7 @@ int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command) int ret; param = strnchr(command, strlen(command), ' '); - if (param == NULL) { + if (!param) { hdd_err("strnchr failed to find delimiter"); return -EINVAL; } @@ -974,7 +974,7 @@ void __hdd_indicate_mgmt_frame(struct hdd_adapter *adapter, hdd_debug("Frame Type = %d Frame Length = %d", frame_type, frm_len); - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL"); return; } @@ -1003,7 +1003,7 @@ void __hdd_indicate_mgmt_frame(struct hdd_adapter *adapter, if (!adapter) adapter = hdd_get_adapter_by_rand_macaddr(hdd_ctx, dest_addr); - if (NULL == adapter) { + if (!adapter) { /* * Under assumtion that we don't receive any action * frame with BCST as destination, @@ -1018,7 +1018,7 @@ void __hdd_indicate_mgmt_frame(struct hdd_adapter *adapter, * in OCB mode */ adapter = hdd_get_adapter(hdd_ctx, QDF_OCB_MODE); - if (NULL == adapter || !qdf_is_macaddr_broadcast( + if (!adapter || !qdf_is_macaddr_broadcast( (struct qdf_mac_addr *)dest_addr)) { /* * Under assumtion that we don't @@ -1031,7 +1031,7 @@ void __hdd_indicate_mgmt_frame(struct hdd_adapter *adapter, } } - if (NULL == adapter->dev) { + if (!adapter->dev) { hdd_err("adapter->dev is NULL"); return; } @@ -1128,7 +1128,7 @@ static int32_t wlan_hdd_update_mcc_adaptive_scheduler( struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); uint8_t enable_mcc_adaptive_sch = 0; - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("HDD context is null"); return -EINVAL; } @@ -1325,7 +1325,7 @@ int wlan_hdd_set_mcc_p2p_quota(struct hdd_adapter *adapter, return -EFAULT; } hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("HDD context is null"); return -EINVAL; } @@ -1385,7 +1385,7 @@ void wlan_hdd_set_mcc_latency(struct hdd_adapter *adapter, int set_value) } hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("HDD context is null"); return; } diff --git a/core/hdd/src/wlan_hdd_packet_filter.c b/core/hdd/src/wlan_hdd_packet_filter.c index dee12e768c93..a9c6f2641529 100644 --- a/core/hdd/src/wlan_hdd_packet_filter.c +++ b/core/hdd/src/wlan_hdd_packet_filter.c @@ -33,7 +33,7 @@ int hdd_enable_default_pkt_filters(struct hdd_adapter *adapter) uint8_t filters = 0, i = 0, filter_id = 1; hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("HDD context is Null!!!"); return -EINVAL; } @@ -69,7 +69,7 @@ int hdd_disable_default_pkt_filters(struct hdd_adapter *adapter) struct pkt_filter_cfg packet_filter_default_rules = {0}; hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (hdd_ctx == NULL) { + if (!hdd_ctx) { hdd_err("HDD context is Null!!!"); return -EINVAL; } diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 607fc0f4cf1d..fb38028b6791 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -388,7 +388,7 @@ void hdd_enable_ns_offload(struct hdd_adapter *adapter, } in6_dev = __in6_dev_get(adapter->dev); - if (NULL == in6_dev) { + if (!in6_dev) { hdd_err("IPv6 dev does not exist. Failed to request NSOffload"); goto out; } @@ -1448,7 +1448,7 @@ int wlan_hdd_set_powersave(struct hdd_adapter *adapter, QDF_STATUS status = QDF_STATUS_SUCCESS; bool is_bmps_enabled; - if (NULL == adapter) { + if (!adapter) { hdd_err("Adapter NULL"); return -ENODEV; } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index f6d1c52121c2..7b4a5df0b597 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -454,7 +454,7 @@ static void hdd_process_regulatory_data(struct hdd_context *hdd_ctx, for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS; band_num++) { - if (wiphy->bands[band_num] == NULL) + if (!wiphy->bands[band_num]) continue; for (chan_num = 0; @@ -543,7 +543,7 @@ static void hdd_process_regulatory_data(struct hdd_context *hdd_ctx, (1 << WMI_REG_EXT_FCC_CH_144))) { cds_chan = &(reg_channels[CHAN_ENUM_144]); cds_chan->state = CHANNEL_STATE_DISABLE; - if (NULL != wiphy_chan_144) + if (wiphy_chan_144) wiphy_chan_144->flags |= IEEE80211_CHAN_DISABLED; } @@ -671,7 +671,7 @@ void hdd_update_indoor_channel(struct hdd_context *hdd_ctx, band_capability = hdd_ctx->curr_band; for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS; band_num++) { - if (wiphy->bands[band_num] == NULL) + if (!wiphy->bands[band_num]) continue; for (chan_num = 0; @@ -990,7 +990,7 @@ void hdd_reg_notifier(struct wiphy *wiphy, request->initiator, request->dfs_region); - if (NULL == hdd_ctx) { + if (!hdd_ctx) { hdd_err("invalid hdd_ctx pointer"); return; } @@ -1133,7 +1133,7 @@ static void fill_wiphy_band_channels(struct wiphy *wiphy, uint32_t chan_cnt; struct ieee80211_channel *wiphy_chan; - if (wiphy->bands[band_id] == NULL) + if (!wiphy->bands[band_id]) return; wiphy_num_chan = wiphy->bands[band_id]->n_channels; diff --git a/core/hdd/src/wlan_hdd_rx_monitor.c b/core/hdd/src/wlan_hdd_rx_monitor.c index cbc3acfe6757..fc1b479186f6 100644 --- a/core/hdd/src/wlan_hdd_rx_monitor.c +++ b/core/hdd/src/wlan_hdd_rx_monitor.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 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 @@ void hdd_rx_monitor_callback(ol_osif_vdev_handle context, /* walk the chain until all are processed */ skb = (struct sk_buff *)rxbuf; - while (NULL != skb) { + while (skb) { skb_next = skb->next; skb->dev = adapter->dev; diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index 8ce3bb3a3a3f..5958fedb623b 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -234,7 +234,7 @@ static bool wlan_hdd_sap_skip_scan_check(struct hdd_context *hdd_ctx, if (hdd_ctx->skip_acs_scan_status != eSAP_SKIP_ACS_SCAN) return false; qdf_spin_lock(&hdd_ctx->acs_skip_lock); - if (hdd_ctx->last_acs_channel_list == NULL || + if (!hdd_ctx->last_acs_channel_list || hdd_ctx->num_of_channels == 0 || request->n_channels == 0) { qdf_spin_unlock(&hdd_ctx->acs_skip_lock); @@ -642,7 +642,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, scan_info->default_scan_ies_len; params.default_ie.ptr = qdf_mem_malloc(scan_info->default_scan_ies_len); - if (params.default_ie.ptr != NULL) { + if (params.default_ie.ptr) { qdf_mem_copy(params.default_ie.ptr, scan_info->default_scan_ies, scan_info->default_scan_ies_len); @@ -676,7 +676,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, goto error; } - if ((request->n_ssids == 1) && (request->ssids != NULL) && + if ((request->n_ssids == 1) && (request->ssids) && (request->ssids[0].ssid_len > 7) && !qdf_mem_cmp(&request->ssids[0], "DIRECT-", 7)) ucfg_p2p_status_scan(vdev); @@ -1364,7 +1364,7 @@ int wlan_hdd_sched_scan_stop(struct net_device *dev) return -EINVAL; hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (NULL == hdd_ctx) { + if (!hdd_ctx) { hdd_err("HDD context is Null"); return -EINVAL; } diff --git a/core/hdd/src/wlan_hdd_softap_tx_rx.c b/core/hdd/src/wlan_hdd_softap_tx_rx.c index 1ab498bb43d9..95a96ae0d0b2 100644 --- a/core/hdd/src/wlan_hdd_softap_tx_rx.c +++ b/core/hdd/src/wlan_hdd_softap_tx_rx.c @@ -857,7 +857,7 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf) } hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (unlikely(NULL == hdd_ctx)) { + if (unlikely(!hdd_ctx)) { QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, "%s: HDD context is Null", __func__); return QDF_STATUS_E_FAILURE; @@ -881,7 +881,7 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf) skb->dev = adapter->dev; - if (unlikely(skb->dev == NULL)) { + if (unlikely(!skb->dev)) { QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, "%s: ERROR!!Invalid netdevice", __func__); @@ -955,7 +955,7 @@ QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *adapter, QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; struct hdd_context *hdd_ctx; - if (NULL == adapter) { + if (!adapter) { hdd_err("NULL adapter"); return QDF_STATUS_E_INVAL; } diff --git a/core/hdd/src/wlan_hdd_spectralscan.c b/core/hdd/src/wlan_hdd_spectralscan.c index be4284df10a1..cd637dd05468 100644 --- a/core/hdd/src/wlan_hdd_spectralscan.c +++ b/core/hdd/src/wlan_hdd_spectralscan.c @@ -403,7 +403,7 @@ static void send_spectral_scan_reg_rsp_msg(struct hdd_context *hdd_ctx) skb = alloc_skb(NLMSG_SPACE(sizeof(struct spectral_scan_msg)), GFP_KERNEL); - if (skb == NULL) { + if (!skb) { hdd_err("Skb allocation failed"); return; } diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 53bf3c5edf43..cbd4768915f8 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -271,7 +271,7 @@ static bool put_wifi_peer_info(tpSirWifiPeerInfo stats, rateInfo = nla_nest_start(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); - if (rateInfo == NULL) + if (!rateInfo) goto error; for (i = 0; i < stats->numRate; i++) { @@ -281,7 +281,7 @@ static bool put_wifi_peer_info(tpSirWifiPeerInfo stats, sizeof (tSirWifiRateStat))); rates = nla_nest_start(vendor_event, i); - if (rates == NULL) + if (!rates) goto error; if (false == @@ -489,12 +489,12 @@ static bool put_wifi_iface_stats(tpSirWifiIfaceStat pWifiIfaceStat, wmmInfo = nla_nest_start(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); - if (wmmInfo == NULL) + if (!wmmInfo) return false; for (i = 0; i < WIFI_AC_MAX; i++) { wmmStats = nla_nest_start(vendor_event, i); - if (wmmStats == NULL) + if (!wmmStats) return false; if (false == @@ -671,7 +671,7 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter, peerInfo = nla_nest_start(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); - if (peerInfo == NULL) { + if (!peerInfo) { hdd_err("nla_nest_start failed"); kfree_skb(vendor_event); return; @@ -679,7 +679,7 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter, for (i = 1; i <= pWifiPeerStat->numPeers; i++) { peers = nla_nest_start(vendor_event, i); - if (peers == NULL) { + if (!peers) { hdd_err("nla_nest_start failed"); kfree_skb(vendor_event); return; @@ -795,7 +795,7 @@ static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter, chlist = nla_nest_start(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); - if (chlist == NULL) { + if (!chlist) { hdd_err("nla_nest_start failed"); return -EINVAL; } @@ -806,7 +806,7 @@ static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter, (i * sizeof(tSirWifiChannelStats))); chinfo = nla_nest_start(vendor_event, i); - if (chinfo == NULL) { + if (!chinfo) { hdd_err("nla_nest_start failed"); return -EINVAL; } @@ -1810,7 +1810,7 @@ static int hdd_populate_wifi_peer_ps_info(tSirWifiPeerStat *data, peer_info = nla_nest_start(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_EXT_PEER_PS_CHG); - if (peer_info == NULL) { + if (!peer_info) { hdd_err("nla_nest_start failed"); return -EINVAL; } @@ -1819,7 +1819,7 @@ static int hdd_populate_wifi_peer_ps_info(tSirWifiPeerStat *data, wifi_peer_info = &data->peerInfo[i]; peers = nla_nest_start(vendor_event, i); - if (peers == NULL) { + if (!peers) { hdd_err("nla_nest_start failed"); return -EINVAL; } @@ -1847,7 +1847,7 @@ hdd_populate_tx_failure_info(struct sir_wifi_iface_tx_fail *tx_fail, { int status = 0; - if (tx_fail == NULL || skb == NULL) + if (!tx_fail || !skb) return -EINVAL; if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_LL_STATS_EXT_TID, @@ -3022,7 +3022,7 @@ wlan_hdd_cfg80211_stats_ext2_callback(hdd_handle_t hdd_handle, if (0 != status) return; - if (NULL == pmsg) { + if (!pmsg) { hdd_err("msg received here is null"); return; } @@ -4830,7 +4830,7 @@ static bool wlan_hdd_update_survey_info(struct wiphy *wiphy, mutex_lock(&hdd_ctx->chan_info_lock); for (i = 0; i < HDD_NUM_NL80211_BANDS && !filled; i++) { - if (wiphy->bands[i] == NULL) + if (!wiphy->bands[i]) continue; for (j = 0; j < wiphy->bands[i]->n_channels && !filled; j++) { @@ -4876,7 +4876,7 @@ static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, if (0 != status) return status; - if (hdd_ctx->chan_info == NULL) { + if (!hdd_ctx->chan_info) { hdd_debug("chan_info is NULL"); return -EINVAL; } @@ -5186,7 +5186,7 @@ QDF_STATUS wlan_hdd_get_rssi(struct hdd_adapter *adapter, int8_t *rssi_value) struct hdd_station_ctx *sta_ctx; struct stats_event *rssi_info; - if (NULL == adapter) { + if (!adapter) { hdd_err("Invalid context, adapter"); return QDF_STATUS_E_FAULT; } @@ -5282,7 +5282,7 @@ QDF_STATUS wlan_hdd_get_rssi(struct hdd_adapter *adapter, int8_t *rssi_value) .timeout_ms = WLAN_WAIT_TIME_STATS, }; - if (NULL == adapter) { + if (!adapter) { hdd_err("Invalid context, adapter"); return QDF_STATUS_E_FAULT; } @@ -5410,7 +5410,7 @@ QDF_STATUS wlan_hdd_get_snr(struct hdd_adapter *adapter, int8_t *snr) hdd_enter(); - if (NULL == adapter) { + if (!adapter) { hdd_err("Invalid context, adapter"); return QDF_STATUS_E_FAULT; } @@ -5828,7 +5828,7 @@ static void hdd_get_class_a_statistics_cb(void *stats, void *context) tCsrGlobalClassAStatsInfo *returned_stats; hdd_enter(); - if (NULL == stats) { + if (!stats) { hdd_err("Bad param, stats"); return; } @@ -5860,7 +5860,7 @@ QDF_STATUS wlan_hdd_get_class_astats(struct hdd_adapter *adapter) .timeout_ms = WLAN_WAIT_TIME_STATS, }; - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL"); return QDF_STATUS_E_FAULT; } @@ -6013,7 +6013,7 @@ static void hdd_get_station_statistics_cb(void *stats, void *context) tCsrGlobalClassAStatsInfo *class_a_stats; struct csr_per_chain_rssi_stats_info *per_chain_rssi_stats; - if ((NULL == stats) || (NULL == context)) { + if ((!stats) || (!context)) { hdd_err("Bad param, stats [%pK] context [%pK]", stats, context); return; @@ -6053,7 +6053,7 @@ int wlan_hdd_get_station_stats(struct hdd_adapter *adapter) .timeout_ms = WLAN_WAIT_TIME_STATS, }; - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL"); return 0; } @@ -6154,7 +6154,7 @@ int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature) }; hdd_enter(); - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL"); return -EPERM; } diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index ae2ffefda324..313f43fad8ba 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -225,7 +225,7 @@ __wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy, if (0 != ret) return -EINVAL; - if (NULL == adapter) + if (!adapter) return -EINVAL; if (wlan_cfg80211_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_MAX, @@ -664,7 +664,7 @@ static int __wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, TRACE_CODE_HDD_CFG80211_TDLS_OPER, adapter->vdev_id, oper); - if (NULL == peer) { + if (!peer) { hdd_err("Invalid arguments"); return -EINVAL; } diff --git a/core/hdd/src/wlan_hdd_tsf.c b/core/hdd/src/wlan_hdd_tsf.c index fa8e24f6b148..1cd28ad1e696 100644 --- a/core/hdd/src/wlan_hdd_tsf.c +++ b/core/hdd/src/wlan_hdd_tsf.c @@ -254,7 +254,7 @@ static enum hdd_tsf_op_result hdd_capture_tsf_internal( struct hdd_context *hddctx; qdf_mc_timer_t *cap_timer; - if (adapter == NULL || buf == NULL) { + if (!adapter || !buf) { hdd_err("invalid pointer"); return HDD_TSF_OP_FAIL; } @@ -1321,7 +1321,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_deinit(struct hdd_context *hdd_ctx) status = hdd_get_front_adapter(hdd_ctx, &adapternode_ptr); - while (NULL != adapternode_ptr && QDF_STATUS_SUCCESS == status) { + while (adapternode_ptr && QDF_STATUS_SUCCESS == status) { adapter = adapternode_ptr; status = hdd_get_next_adapter(hdd_ctx, adapternode_ptr, &next_ptr); @@ -1470,7 +1470,7 @@ int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf) QDF_TIMER_STATE capture_req_timer_status; qdf_mc_timer_t *capture_timer; - if (pcb_cxt == NULL || ptsf == NULL) { + if (!pcb_cxt || !ptsf) { hdd_err("HDD context is not valid"); return -EINVAL; } @@ -1482,7 +1482,7 @@ int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf) adapter = hdd_get_adapter_by_vdev(hddctx, ptsf->vdev_id); - if (NULL == adapter) { + if (!adapter) { hdd_err("failed to find adapter"); return -EINVAL; } diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index bca2d1815744..0cd6130f1ae2 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -303,7 +303,7 @@ bool hdd_tx_flow_control_is_pause(void *adapter_context) { struct hdd_adapter *adapter = (struct hdd_adapter *) adapter_context; - if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { + if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { /* INVALID ARG */ hdd_err("invalid adapter %pK", adapter); return false; @@ -580,7 +580,7 @@ void hdd_reset_all_adapters_connectivity_stats(struct hdd_context *hdd_ctx) status = hdd_get_front_adapter(hdd_ctx, &adapter); - while (NULL != adapter && QDF_STATUS_SUCCESS == status) { + while (adapter && QDF_STATUS_SUCCESS == status) { hdd_clear_tx_rx_connectivity_stats(adapter); status = hdd_get_next_adapter(hdd_ctx, adapter, &next); adapter = next; @@ -613,7 +613,7 @@ static inline bool hdd_is_tx_allowed(struct sk_buff *skb, uint8_t peer_id) peer = cdp_peer_find_by_local_id(soc, pdev, peer_id); - if (peer == NULL) { + if (!peer) { hdd_err_rl("Unable to find peer entry for sta_id: %d", peer_id); return false; } @@ -1314,7 +1314,7 @@ QDF_STATUS hdd_init_tx_rx(struct hdd_adapter *adapter) { QDF_STATUS status = QDF_STATUS_SUCCESS; - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL"); QDF_ASSERT(0); return QDF_STATUS_E_FAILURE; @@ -1363,14 +1363,14 @@ static QDF_STATUS hdd_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf) unsigned int cpu_index; /* Sanity check on inputs */ - if ((NULL == context) || (NULL == rxbuf)) { + if ((!context) || (!rxbuf)) { QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, "%s: Null params being passed", __func__); return QDF_STATUS_E_FAILURE; } adapter = (struct hdd_adapter *)context; - if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { + if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, "invalid adapter %pK", adapter); return QDF_STATUS_E_FAILURE; @@ -1380,7 +1380,7 @@ static QDF_STATUS hdd_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf) /* walk the chain until all are processed */ skb = (struct sk_buff *) rxbuf; - while (NULL != skb) { + while (skb) { skb_next = skb->next; skb->dev = adapter->dev; @@ -1654,11 +1654,11 @@ QDF_STATUS hdd_gro_rx_legacy(struct hdd_adapter *adapter, struct sk_buff *skb) return QDF_STATUS_E_NOSUPPORT; napid = hdd_napi_get_all(); - if (unlikely(napid == NULL)) + if (unlikely(!napid)) goto out; qca_napii = hif_get_napi(QDF_NBUF_CB_RX_CTX_ID(skb), napid); - if (unlikely(qca_napii == NULL)) + if (unlikely(!qca_napii)) goto out; /* @@ -2017,7 +2017,7 @@ QDF_STATUS hdd_rx_packet_cbk(void *adapter_context, } hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (unlikely(NULL == hdd_ctx)) { + if (unlikely(!hdd_ctx)) { QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, "%s: HDD context is Null", __func__); return QDF_STATUS_E_FAILURE; diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 90cf8b7612df..d61fdcb09b18 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -3000,7 +3000,7 @@ void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len) } ptr = qdf_mem_malloc(len + 1); - if (NULL == ptr) { + if (!ptr) { hdd_err("unable to allocate memory"); return NULL; } @@ -3025,7 +3025,7 @@ void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len) */ int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu) { - if ((NULL == p_priv_data) || (NULL == wrqu)) + if ((!p_priv_data) || (!wrqu)) return -EINVAL; #ifdef CONFIG_COMPAT @@ -5973,7 +5973,7 @@ static int __iw_setchar_getnone(struct net_device *dev, return -EINVAL; /* make sure all params are correctly passed to function */ - if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) + if ((!s_priv_data.pointer) || (0 == s_priv_data.length)) return -EINVAL; sub_cmd = s_priv_data.flags; @@ -6627,7 +6627,7 @@ static int hdd_set_fwtest(int argc, int cmd, int value) return -EINVAL; } fw_test = qdf_mem_malloc(sizeof(*fw_test)); - if (NULL == fw_test) { + if (!fw_test) { hdd_err("qdf_mem_malloc failed for fw_test"); return -ENOMEM; } @@ -8227,7 +8227,7 @@ static int iw_hdd_set_var_ints_getnone(struct net_device *dev, if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu)) return -EINVAL; - if (NULL == u_priv_wrqu.data.pointer) { + if (!u_priv_wrqu.data.pointer) { hdd_err("NULL data pointer"); return -EINVAL; } @@ -8341,7 +8341,7 @@ static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info, return 0; } /* make sure all params are correctly passed to function */ - if ((NULL == s_priv_data.pointer) || + if ((!s_priv_data.pointer) || (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) { *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; return 0; @@ -8640,7 +8640,7 @@ static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info, hdd_err("called with 0 length IEs"); return -EINVAL; } - if (wrqu->data.pointer == NULL) { + if (!wrqu->data.pointer) { hdd_err("called with NULL IE"); return -EINVAL; } @@ -8978,7 +8978,7 @@ static int __iw_set_packet_filter_params(struct net_device *dev, return -EINVAL; } - if ((NULL == priv_data.pointer) || (0 == priv_data.length)) { + if ((!priv_data.pointer) || (0 == priv_data.length)) { hdd_err("invalid priv data %pK or invalid priv data length %d", priv_data.pointer, priv_data.length); return -EINVAL; @@ -8999,7 +8999,7 @@ static int __iw_set_packet_filter_params(struct net_device *dev, request = mem_alloc_copy_from_user_helper(priv_data.pointer, priv_data.length); - if (NULL == request) { + if (!request) { hdd_err("mem_alloc_copy_from_user_helper fail"); return -ENOMEM; } diff --git a/core/hdd/src/wlan_hdd_wmm.c b/core/hdd/src/wlan_hdd_wmm.c index 537c9ddf130c..4ef3143775a6 100644 --- a/core/hdd/src/wlan_hdd_wmm.c +++ b/core/hdd/src/wlan_hdd_wmm.c @@ -233,7 +233,7 @@ static void hdd_wmm_free_context(struct hdd_wmm_qos_context *qos_context) hdd_debug("Entered, context %pK", qos_context); - if (unlikely((NULL == qos_context) || + if (unlikely((!qos_context) || (HDD_WMM_CTX_MAGIC != qos_context->magic))) { /* must have been freed in another thread */ return; @@ -276,7 +276,7 @@ static void hdd_wmm_notify_app(struct hdd_wmm_qos_context *qos_context) hdd_debug("Entered, context %pK", qos_context); - if (unlikely((NULL == qos_context) || + if (unlikely((!qos_context) || (HDD_WMM_CTX_MAGIC != qos_context->magic))) { hdd_err("Invalid QoS Context"); return; @@ -333,7 +333,7 @@ static void hdd_wmm_inactivity_timer_cb(void *user_data) ac_type = qos_context->ac_type; adapter = qos_context->adapter; - if ((NULL == adapter) || + if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { hdd_err("invalid adapter: %pK", adapter); return; @@ -502,7 +502,7 @@ static QDF_STATUS hdd_wmm_sme_callback(mac_handle_t mac_handle, hdd_debug("Entered, context %pK", qos_context); - if (unlikely((NULL == qos_context) || + if (unlikely((!qos_context) || (HDD_WMM_CTX_MAGIC != qos_context->magic))) { hdd_err("Invalid QoS Context"); return QDF_STATUS_E_FAILURE; @@ -985,11 +985,11 @@ static QDF_STATUS hdd_wmm_sme_callback(mac_handle_t mac_handle, */ int hdd_wmmps_helper(struct hdd_adapter *adapter, uint8_t *ptr) { - if (NULL == adapter) { + if (!adapter) { hdd_err("adapter is NULL"); return -EINVAL; } - if (NULL == ptr) { + if (!ptr) { hdd_err("ptr is NULL"); return -EINVAL; } @@ -1962,7 +1962,7 @@ QDF_STATUS hdd_wmm_acquire_access(struct hdd_adapter *adapter, adapter->hdd_wmm_status.ac_status[ac_type].is_access_needed = true; qos_context = qdf_mem_malloc(sizeof(*qos_context)); - if (NULL == qos_context) { + if (!qos_context) { /* no memory for QoS context. Nothing we can do but * let data flow */ @@ -2381,7 +2381,7 @@ hdd_wlan_wmm_status_e hdd_wmm_addts(struct hdd_adapter *adapter, } qos_context = qdf_mem_malloc(sizeof(*qos_context)); - if (NULL == qos_context) { + if (!qos_context) { /* no memory for QoS context. Nothing we can do */ hdd_err("Unable to allocate QoS context"); return HDD_WLAN_WMM_STATUS_INTERNAL_FAILURE; diff --git a/core/hdd/src/wlan_hdd_wowl.c b/core/hdd/src/wlan_hdd_wowl.c index fb3f07b6cb4d..271a20ef7489 100644 --- a/core/hdd/src/wlan_hdd_wowl.c +++ b/core/hdd/src/wlan_hdd_wowl.c @@ -122,7 +122,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) /* check if pattern is already configured */ for (i = num_filters - 1; i >= 0; i--) { - if (g_hdd_wowl_ptrns[i] == NULL) { + if (!g_hdd_wowl_ptrns[i]) { empty_slot = i; continue; } @@ -215,7 +215,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) /* All is good. Store the pattern locally */ g_hdd_wowl_ptrns[empty_slot] = qdf_mem_malloc(len + 1); - if (g_hdd_wowl_ptrns[empty_slot] == NULL) { + if (!g_hdd_wowl_ptrns[empty_slot]) { hdd_err("memory allocation failure"); return false; }