diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 716c00420df4..542c15fae06c 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -3972,13 +3972,12 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, hdd_info("TDLS ExternalControl enabled but curr_peer is not forced, ignore SHOULD_DISCOVER"); status = QDF_STATUS_SUCCESS; break; - } else { - hdd_info("initiate TDLS setup on SHOULD_DISCOVER, fTDLSExternalControl: %d, curr_peer->isForcedPeer: %d, reason: %d", - pHddCtx->config-> - fTDLSExternalControl, - curr_peer->isForcedPeer, - pRoamInfo->reasonCode); } + hdd_info("initiate TDLS setup on SHOULD_DISCOVER, fTDLSExternalControl: %d, curr_peer->isForcedPeer: %d, reason: %d", + pHddCtx->config-> + fTDLSExternalControl, + curr_peer->isForcedPeer, + pRoamInfo->reasonCode); pHddTdlsCtx->curr_candidate = curr_peer; wlan_hdd_tdls_implicit_send_discovery_request( pHddTdlsCtx); diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index c1326666a32d..aadd6d68c535 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4187,14 +4187,12 @@ static char *get_next_line(char *str) c = *str; } - if (c == '\0') { + if (c == '\0') return NULL; - } else { - *str = '\0'; - return str + 1; - } - return NULL; + *str = '\0'; + + return str + 1; } /** look for space. Ascii values to look are @@ -5843,31 +5841,32 @@ QDF_STATUS hdd_parse_config_ini(hdd_context_t *pHddCtx) if (strlen((char *)buffer) == 0 || *buffer == '#') { buffer = line; continue; - } else if (strncmp(buffer, "END", 3) == 0) { + } + + if (strncmp(buffer, "END", 3) == 0) break; - } else { - name = buffer; - while (*buffer != '=' && *buffer != '\0') - buffer++; - if (*buffer != '\0') { - *buffer++ = '\0'; - i_trim(name); - if (strlen(name) != 0) { - buffer = i_trim(buffer); - if (strlen(buffer) > 0) { - value = buffer; - while (!i_isspace(*buffer) - && *buffer != '\0') - buffer++; - *buffer = '\0'; - cfgIniTable[i].name = name; - cfgIniTable[i++].value = value; - if (i >= MAX_CFG_INI_ITEMS) { - hdd_err("Number of items in %s > %d", - WLAN_INI_FILE, - MAX_CFG_INI_ITEMS); - break; - } + + name = buffer; + while (*buffer != '=' && *buffer != '\0') + buffer++; + if (*buffer != '\0') { + *buffer++ = '\0'; + i_trim(name); + if (strlen(name) != 0) { + buffer = i_trim(buffer); + if (strlen(buffer) > 0) { + value = buffer; + while (!i_isspace(*buffer) + && *buffer != '\0') + buffer++; + *buffer = '\0'; + cfgIniTable[i].name = name; + cfgIniTable[i++].value = value; + if (i >= MAX_CFG_INI_ITEMS) { + hdd_err("Number of items in %s > %d", + WLAN_INI_FILE, + MAX_CFG_INI_ITEMS); + break; } } } diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 2ae2dffd1dbd..220e6e6b457a 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -1355,16 +1355,16 @@ int wlan_hdd_cfg80211_start_acs(hdd_adapter_t *adapter) sap_config->channel = AUTO_CHANNEL_SELECT; status = wlan_hdd_sap_cfg_dfs_override(adapter); - if (status < 0) { + if (status < 0) return status; - } else { - if (status > 0) { - /*notify hostapd about channel override */ - wlan_hdd_cfg80211_acs_ch_select_evt(adapter); - clear_bit(ACS_IN_PROGRESS, &hdd_ctx->g_event_flags); - return 0; - } + + if (status > 0) { + /*notify hostapd about channel override */ + wlan_hdd_cfg80211_acs_ch_select_evt(adapter); + clear_bit(ACS_IN_PROGRESS, &hdd_ctx->g_event_flags); + return 0; } + status = wlan_hdd_config_acs(hdd_ctx, adapter); if (status) { hdd_err("ACS config failed"); @@ -5380,12 +5380,12 @@ __wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, if (control == WLAN_START_OFFLOADED_PACKETS) return wlan_hdd_add_tx_ptrn(adapter, hdd_ctx, tb); - else if (control == WLAN_STOP_OFFLOADED_PACKETS) + if (control == WLAN_STOP_OFFLOADED_PACKETS) return wlan_hdd_del_tx_ptrn(adapter, hdd_ctx, tb); - else { - hdd_err("Invalid control: %d", control); - return -EINVAL; - } + + hdd_err("Invalid control: %d", control); + + return -EINVAL; } /* @@ -7354,9 +7354,9 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(hdd_context_t *hdd_ctx, !CDS_IS_DFS_CH(channel)) { hdd_err("Invalid channel for pre cac:%d", channel); return -EINVAL; - } else { - *pre_cac_chan = channel; } + + *pre_cac_chan = channel; } hdd_info("selected pre cac channel:%d", *pre_cac_chan); return 0; @@ -13756,6 +13756,9 @@ static int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter, /*incase of WEP set default key information */ if (req->key && req->key_len) { + u8 key_len = req->key_len; + u8 key_idx = req->key_idx; + if ((WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) @@ -13766,25 +13769,20 @@ static int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter, authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) { hdd_err("Dynamic WEP not supported"); return -EOPNOTSUPP; - } else { - u8 key_len = req->key_len; - u8 key_idx = req->key_idx; + } - if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= - key_len) - && (CSR_MAX_NUM_KEY > key_idx) - ) { - hdd_notice("setting default wep key, key_idx = %hu key_len %hu", - key_idx, key_len); - qdf_mem_copy(&pWextState->roamProfile. - Keys. - KeyMaterial[key_idx][0], - req->key, key_len); - pWextState->roamProfile.Keys. + if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) + && (CSR_MAX_NUM_KEY > key_idx)) { + hdd_notice("setting default wep key, key_idx = %hu key_len %hu", + key_idx, key_len); + qdf_mem_copy(&pWextState->roamProfile. + Keys. + KeyMaterial[key_idx][0], + req->key, key_len); + pWextState->roamProfile.Keys. KeyLength[key_idx] = (u8) key_len; - pWextState->roamProfile.Keys. + pWextState->roamProfile.Keys. defaultIndex = (u8) key_idx; - } } } } diff --git a/core/hdd/src/wlan_hdd_ext_scan.c b/core/hdd/src/wlan_hdd_ext_scan.c index e5a688b49d80..57f50eb8fef6 100644 --- a/core/hdd/src/wlan_hdd_ext_scan.c +++ b/core/hdd/src/wlan_hdd_ext_scan.c @@ -183,11 +183,10 @@ wlan_hdd_cfg80211_extscan_get_capabilities_rsp(void *ctx, hdd_err("Target response id did not match: request_id %d response_id %d", context->request_id, data->requestId); return; - } else { - context->capability_response = *data; - complete(&context->response_event); } + context->capability_response = *data; + complete(&context->response_event); spin_unlock(&context->context_lock); return; diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index f19e61207d5f..8eac2daa650f 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1983,23 +1983,22 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, * only for non driver override acs */ if (pHostapdAdapter->device_mode == QDF_SAP_MODE && - pHddCtx->config->force_sap_acs) { + pHddCtx->config->force_sap_acs) return QDF_STATUS_SUCCESS; - } else { - chan_change.chan = - pSapEvent->sapevt.sap_ch_selected.pri_ch; - chan_change.chan_params.ch_width = - pSapEvent->sapevt.sap_ch_selected.ch_width; - chan_change.chan_params.sec_ch_offset = - pSapEvent->sapevt.sap_ch_selected.ht_sec_ch; - chan_change.chan_params.center_freq_seg0 = - pSapEvent->sapevt.sap_ch_selected.vht_seg0_center_ch; - chan_change.chan_params.center_freq_seg1 = - pSapEvent->sapevt.sap_ch_selected.vht_seg1_center_ch; - return hdd_chan_change_notify(pHostapdAdapter, dev, - chan_change); - } + chan_change.chan = + pSapEvent->sapevt.sap_ch_selected.pri_ch; + chan_change.chan_params.ch_width = + pSapEvent->sapevt.sap_ch_selected.ch_width; + chan_change.chan_params.sec_ch_offset = + pSapEvent->sapevt.sap_ch_selected.ht_sec_ch; + chan_change.chan_params.center_freq_seg0 = + pSapEvent->sapevt.sap_ch_selected.vht_seg0_center_ch; + chan_change.chan_params.center_freq_seg1 = + pSapEvent->sapevt.sap_ch_selected.vht_seg1_center_ch; + + return hdd_chan_change_notify(pHostapdAdapter, dev, + chan_change); case eSAP_ACS_SCAN_SUCCESS_EVENT: return hdd_handle_acs_scan_event(pSapEvent, pHostapdAdapter); case eSAP_DFS_NOL_GET: @@ -2015,10 +2014,9 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, if (ret > 0) { hdd_info("Get %d bytes of dfs nol from PLD", ret); return QDF_STATUS_SUCCESS; - } else { - hdd_info("No dfs nol entry in PLD, ret: %d", ret); - return QDF_STATUS_E_FAULT; } + hdd_info("No dfs nol entry in PLD, ret: %d", ret); + return QDF_STATUS_E_FAULT; case eSAP_DFS_NOL_SET: hdd_notice("Received eSAP_DFS_NOL_SET event"); @@ -4123,11 +4121,11 @@ static int wlan_hdd_set_force_acs_ch_range(struct net_device *dev, wlan_hdd_validate_operation_channel(adapter, value[1]) != QDF_STATUS_SUCCESS) { return -EINVAL; - } else { - hdd_ctx->config->force_sap_acs_st_ch = value[0]; - hdd_ctx->config->force_sap_acs_end_ch = value[1]; } + hdd_ctx->config->force_sap_acs_st_ch = value[0]; + hdd_ctx->config->force_sap_acs_end_ch = value[1]; + return 0; } @@ -4691,17 +4689,16 @@ static int __iw_get_ap_freq(struct net_device *dev, if (sme_cfg_get_int(hHal, WNI_CFG_CURRENT_CHANNEL, &channel) != QDF_STATUS_SUCCESS) { return -EIO; - } else { - status = hdd_wlan_get_freq(channel, &freq); - if (true == status) { - /* Set Exponent parameter as 6 (MHZ) in struct - * iw_freq * iwlist & iwconfig command - * shows frequency into proper - * format (2.412 GHz instead of 246.2 MHz) - */ - fwrq->m = freq; - fwrq->e = MHZ; - } + } + status = hdd_wlan_get_freq(channel, &freq); + if (true == status) { + /* Set Exponent parameter as 6 (MHZ) in struct + * iw_freq * iwlist & iwconfig command + * shows frequency into proper + * format (2.412 GHz instead of 246.2 MHz) + */ + fwrq->m = freq; + fwrq->e = MHZ; } } else { channel = pHddApCtx->operatingChannel; diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index fa853fa72669..6f7acb745179 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -2245,7 +2245,7 @@ static int hdd_parse_setmaxtxpower_command(uint8_t *pValue, int *pTxPower) static int hdd_get_dwell_time(struct hdd_config *pCfg, uint8_t *command, char *extra, uint8_t n, uint8_t *len) { - int ret = 0; + int ret; if (!pCfg || !command || !extra || !len) { hdd_err("argument passed for GETDWELLTIME is incorrect"); @@ -2257,25 +2257,28 @@ static int hdd_get_dwell_time(struct hdd_config *pCfg, uint8_t *command, *len = scnprintf(extra, n, "GETDWELLTIME ACTIVE MAX %u\n", (int)pCfg->nActiveMaxChnTime); return ret; - } else if (strncmp(command, "GETDWELLTIME ACTIVE MIN", 23) == 0) { + } + if (strncmp(command, "GETDWELLTIME ACTIVE MIN", 23) == 0) { *len = scnprintf(extra, n, "GETDWELLTIME ACTIVE MIN %u\n", (int)pCfg->nActiveMinChnTime); return ret; - } else if (strncmp(command, "GETDWELLTIME PASSIVE MAX", 24) == 0) { + } + if (strncmp(command, "GETDWELLTIME PASSIVE MAX", 24) == 0) { *len = scnprintf(extra, n, "GETDWELLTIME PASSIVE MAX %u\n", (int)pCfg->nPassiveMaxChnTime); return ret; - } else if (strncmp(command, "GETDWELLTIME PASSIVE MIN", 24) == 0) { + } + if (strncmp(command, "GETDWELLTIME PASSIVE MIN", 24) == 0) { *len = scnprintf(extra, n, "GETDWELLTIME PASSIVE MIN %u\n", (int)pCfg->nPassiveMinChnTime); return ret; - } else if (strncmp(command, "GETDWELLTIME", 12) == 0) { + } + if (strncmp(command, "GETDWELLTIME", 12) == 0) { *len = scnprintf(extra, n, "GETDWELLTIME %u \n", (int)pCfg->nActiveMaxChnTime); return ret; - } else { - ret = -EINVAL; } + ret = -EINVAL; return ret; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 8e2701c50b9c..252b31df69eb 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9026,17 +9026,15 @@ void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable) if (ap_connected == true || sta_connected == true) { hdd_notice("CC Session active. Shutdown timer not enabled"); return; - } else { - if (sme_set_auto_shutdown_timer(hal_handle, - hdd_ctx->config-> - WlanAutoShutdown) - != QDF_STATUS_SUCCESS) - hdd_err("Failed to start wlan auto shutdown timer"); - else - hdd_notice("Auto Shutdown timer for %d seconds enabled", - hdd_ctx->config->WlanAutoShutdown); - } + + if (sme_set_auto_shutdown_timer(hal_handle, + hdd_ctx->config->WlanAutoShutdown) + != QDF_STATUS_SUCCESS) + hdd_err("Failed to start wlan auto shutdown timer"); + else + hdd_notice("Auto Shutdown timer for %d seconds enabled", + hdd_ctx->config->WlanAutoShutdown); } #endif diff --git a/core/hdd/src/wlan_hdd_memdump.c b/core/hdd/src/wlan_hdd_memdump.c index a4ce2148da97..9980d9181be1 100644 --- a/core/hdd/src/wlan_hdd_memdump.c +++ b/core/hdd/src/wlan_hdd_memdump.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -129,9 +129,8 @@ void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx, context->request_id, dump_rsp->request_id, dump_rsp->dump_complete); return; - } else { - complete(&context->response_event); } + complete(&context->response_event); spin_unlock(&hdd_context_lock); return; diff --git a/core/hdd/src/wlan_hdd_object_manager.c b/core/hdd/src/wlan_hdd_object_manager.c index 71e948e3a103..bddd397f0a69 100644 --- a/core/hdd/src/wlan_hdd_object_manager.c +++ b/core/hdd/src/wlan_hdd_object_manager.c @@ -236,15 +236,16 @@ int hdd_set_peer_mlme_state(struct wlan_objmgr_vdev *vdev, peer = wlan_vdev_get_bsspeer(vdev); wlan_vdev_obj_unlock(vdev); - if (peer) { - wlan_peer_obj_lock(peer); - wlan_peer_mlme_set_state(peer, WLAN_ASSOC_STATE); - wlan_peer_obj_unlock(peer); - return 0; - } else { + if (!peer) { hdd_err("peer is null"); + return -EINVAL; } + wlan_peer_obj_lock(peer); + wlan_peer_mlme_set_state(peer, WLAN_ASSOC_STATE); + wlan_peer_obj_unlock(peer); + + return 0; } diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index de66fa7d2c07..57f969b7317b 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -908,11 +908,11 @@ static int wlan_hdd_request_remain_on_channel(struct wiphy *wiphy, } } return 0; - } else { - if (wlan_hdd_roc_request_enqueue(pAdapter, pRemainChanCtx)) { - qdf_mem_free(pRemainChanCtx); - return -EAGAIN; - } + } + + if (wlan_hdd_roc_request_enqueue(pAdapter, pRemainChanCtx)) { + qdf_mem_free(pRemainChanCtx); + return -EAGAIN; } /* @@ -1146,8 +1146,7 @@ __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, hdd_remain_on_chan_timer) != QDF_STATUS_SUCCESS) hdd_err("Failed to stop hdd_remain_on_chan_timer"); - if (true == - pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress) { + if (pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); hdd_notice("ROC timer cancellation in progress, wait for completion"); rc = wait_for_completion_timeout(&pAdapter-> @@ -1158,9 +1157,8 @@ __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, hdd_err("wait on cancel_rem_on_chan_var timed out"); } return 0; - } else - pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = - true; + } + pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = true; } roc_scan_id = pRemainChanCtx->scan_id; mutex_unlock(&cfgState->remain_on_chan_ctx_lock); diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 104928cea195..98f822dca731 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -185,26 +185,26 @@ static void hdd_conf_gtk_offload(hdd_adapter_t *pAdapter, bool fenable) if (QDF_STATUS_SUCCESS != ret) { hdd_err("sme_get_gtk_offload failed, returned %d", ret); return; - } else { - hdd_notice("sme_get_gtk_offload successful"); - - /* Sending GTK offload dissable */ - memcpy(&hddGtkOffloadReqParams, - &pHddStaCtx->gtkOffloadReqParams, - sizeof(tSirGtkOffloadParams)); - hddGtkOffloadReqParams.ulFlags = - GTK_OFFLOAD_DISABLE; - ret = - sme_set_gtk_offload(WLAN_HDD_GET_HAL_CTX - (pAdapter), - &hddGtkOffloadReqParams, - pAdapter->sessionId); - if (QDF_STATUS_SUCCESS != ret) { - hdd_err("failed to dissable GTK offload, returned %d", ret); - return; - } - hdd_notice("successfully dissabled GTK offload request to HAL"); } + + hdd_notice("sme_get_gtk_offload successful"); + + /* Sending GTK offload dissable */ + memcpy(&hddGtkOffloadReqParams, + &pHddStaCtx->gtkOffloadReqParams, + sizeof(tSirGtkOffloadParams)); + hddGtkOffloadReqParams.ulFlags = + GTK_OFFLOAD_DISABLE; + ret = sme_set_gtk_offload(WLAN_HDD_GET_HAL_CTX + (pAdapter), + &hddGtkOffloadReqParams, + pAdapter->sessionId); + if (QDF_STATUS_SUCCESS != ret) { + hdd_err("failed to dissable GTK offload, returned %d", + ret); + return; + } + hdd_notice("successfully dissabled GTK offload request to HAL"); } } return; @@ -965,8 +965,8 @@ QDF_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, bool fenable) * is controlled by one bit. */ if ((QDF_SAP_MODE == pAdapter->device_mode || - QDF_P2P_GO_MODE == pAdapter->device_mode) && - !pHddCtx->ap_arpns_support) { + QDF_P2P_GO_MODE == pAdapter->device_mode) && + !pHddCtx->ap_arpns_support) { hdd_notice("ARP Offload is not supported in SAP/P2PGO mode"); return QDF_STATUS_SUCCESS; } @@ -1004,23 +1004,24 @@ QDF_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, bool fenable) hdd_notice("IP Address is not assigned"); } - return QDF_STATUS_SUCCESS; - } else { - hdd_wlan_offload_event(SIR_IPV4_ARP_REPLY_OFFLOAD, - SIR_OFFLOAD_DISABLE); - qdf_mem_zero((void *)&offLoadRequest, - sizeof(tSirHostOffloadReq)); - offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE; - offLoadRequest.offloadType = SIR_IPV4_ARP_REPLY_OFFLOAD; - - if (QDF_STATUS_SUCCESS != - sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(pAdapter), - pAdapter->sessionId, &offLoadRequest)) { - hdd_err("Failure to disable host " "offload feature"); - return QDF_STATUS_E_FAILURE; - } return QDF_STATUS_SUCCESS; } + + hdd_wlan_offload_event(SIR_IPV4_ARP_REPLY_OFFLOAD, + SIR_OFFLOAD_DISABLE); + qdf_mem_zero((void *)&offLoadRequest, + sizeof(tSirHostOffloadReq)); + offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE; + offLoadRequest.offloadType = SIR_IPV4_ARP_REPLY_OFFLOAD; + + if (QDF_STATUS_SUCCESS != + sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(pAdapter), + pAdapter->sessionId, &offLoadRequest)) { + hdd_err("Failure to disable host offload feature"); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; } #ifdef WLAN_FEATURE_PACKET_FILTERING diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index cea40110f927..4ccf42ae8d5f 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -644,13 +644,13 @@ static QDF_STATUS wlan_hdd_scan_request_dequeue(hdd_context_t *hdd_ctx, scan_id, req, qdf_list_size(&hdd_ctx->hdd_scan_req_q)); return QDF_STATUS_SUCCESS; - } else { - qdf_spin_unlock(&hdd_ctx->hdd_scan_req_q_lock); - hdd_err("Failed to remove node scan id %d, pending scans %d", - scan_id, - qdf_list_size(&hdd_ctx->hdd_scan_req_q)); - return status; } + + qdf_spin_unlock(&hdd_ctx->hdd_scan_req_q_lock); + hdd_err("Failed to remove node scan id %d, pending scans %d", + scan_id, + qdf_list_size(&hdd_ctx->hdd_scan_req_q)); + return status; } } while (QDF_STATUS_SUCCESS == qdf_list_peek_next(&hdd_ctx->hdd_scan_req_q, pNode, &ppNode)); diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index b8763a3de09a..b6edbad92492 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -2896,19 +2896,20 @@ int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy, connectedTdlsPeers, pHddCtx->tdls_mode); return 1; - } else { - for (i = 0; i < num; i++) { - hdd_notice("indicate TDLS teadown (staId %d)", - connectedPeerList[i]->staId); - wlan_hdd_tdls_indicate_teardown - (connectedPeerList[i]->pHddTdlsCtx-> - pAdapter, connectedPeerList[i], - eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); - hdd_send_wlan_tdls_teardown_event( - eTDLS_TEARDOWN_SCAN, - connectedPeerList[i]->peerMac); - } } + + for (i = 0; i < num; i++) { + hdd_notice("indicate TDLS teadown (staId %d)", + connectedPeerList[i]->staId); + wlan_hdd_tdls_indicate_teardown + (connectedPeerList[i]->pHddTdlsCtx-> + pAdapter, connectedPeerList[i], + eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); + hdd_send_wlan_tdls_teardown_event + (eTDLS_TEARDOWN_SCAN, + connectedPeerList[i]->peerMac); + } + /* schedule scan */ delay = (unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION * @@ -4080,7 +4081,7 @@ static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, /* supplicant still sends tdls_mgmt(SETUP_REQ) * even after we return error code at * 'add_station()'. Hence we have this check - * again in addtion to add_station(). Anyway, + * again in addition to add_station(). Anyway, * there is no harm to double-check. */ if (SIR_MAC_TDLS_SETUP_REQ == action_code) { @@ -4092,24 +4093,23 @@ static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, action_code, numCurrTdlsPeers, pHddCtx->max_num_tdls_sta); return -EINVAL; - } else { - /* maximum reached. tweak to send - * error code to peer and return error - * code to supplicant - */ - status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; - QDF_TRACE(QDF_MODULE_ID_HDD, - QDF_TRACE_LEVEL_ERROR, - "%s: " MAC_ADDRESS_STR - " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", - __func__, MAC_ADDR_ARRAY(peer), - status_code, numCurrTdlsPeers, - pHddCtx->max_num_tdls_sta); - max_sta_failed = -EPERM; - /* fall through to send setup resp - * with failure status code - */ } + /* maximum reached. tweak to send + * error code to peer and return error + * code to supplicant + */ + status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; + QDF_TRACE(QDF_MODULE_ID_HDD, + QDF_TRACE_LEVEL_ERROR, + "%s: " MAC_ADDRESS_STR + " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", + __func__, MAC_ADDR_ARRAY(peer), + status_code, numCurrTdlsPeers, + pHddCtx->max_num_tdls_sta); + max_sta_failed = -EPERM; + /* fall through to send setup resp + * with failure status code + */ } else { hddTdlsPeer_t *pTdlsPeer; pTdlsPeer = @@ -4476,13 +4476,12 @@ int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, hdd_notice("peer matching" MAC_ADDRESS_STR "not found", MAC_ADDR_ARRAY(peer)); return -EINVAL; - } else { - wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, - eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); - hdd_send_wlan_tdls_teardown_event( - eTDLS_TEARDOWN_EXT_CTRL, - pTdlsPeer->peerMac); } + + wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, + eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); + hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_EXT_CTRL, + pTdlsPeer->peerMac); if (0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, false)) { QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, "%s Failed", __func__); @@ -5899,10 +5898,11 @@ int hdd_set_tdls_scan_type(hdd_context_t *hdd_ctx, int val) if ((val != 0) && (val != 1)) { hdd_err("Incorrect value of tdls scan type: %d", val); return -EINVAL; - } else { - hdd_ctx->config->enable_tdls_scan = val; - return 0; } + + hdd_ctx->config->enable_tdls_scan = val; + + return 0; } /** @@ -6009,9 +6009,8 @@ int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx, if (hdd_ctx->tdls_nss_teardown_complete == false) { hdd_err("TDLS antenna switch is in progress"); return -EAGAIN; - } else { - goto tdls_ant_sw_done; } + goto tdls_ant_sw_done; } /* Check whether TDLS is connected or not */ diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index 2f97c1666464..2f640ab93ddc 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -442,16 +442,14 @@ static inline bool hdd_is_tx_allowed(struct sk_buff *skb, uint8_t peer_id) } peer_state = cdp_peer_state_get(soc, peer); - if (likely(OL_TXRX_PEER_STATE_AUTH == peer_state)) { + if (likely(OL_TXRX_PEER_STATE_AUTH == peer_state)) return true; - } else if (OL_TXRX_PEER_STATE_CONN == peer_state && - ntohs(skb->protocol) == HDD_ETHERTYPE_802_1_X) { + if (OL_TXRX_PEER_STATE_CONN == peer_state && + ntohs(skb->protocol) == HDD_ETHERTYPE_802_1_X) return true; - } else { - QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_WARN, - FL("Invalid peer state for Tx: %d"), peer_state); - return false; - } + QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_WARN, + FL("Invalid peer state for Tx: %d"), peer_state); + return false; } /** diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 1c21718a2625..0297cbba21da 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -2931,18 +2931,18 @@ static int __iw_get_freq(struct net_device *dev, struct iw_request_info *info, hdd_err("failed to get operating channel %u", pAdapter->sessionId); return -EIO; - } else { - status = hdd_wlan_get_freq(channel, &freq); - if (true == status) { - /* Set Exponent parameter as 6 (MHZ) - * in struct iw_freq iwlist & iwconfig - * command shows frequency into proper - * format (2.412 GHz instead of 246.2 - * MHz) - */ - fwrq->m = freq; - fwrq->e = MHZ; - } + } + + status = hdd_wlan_get_freq(channel, &freq); + if (true == status) { + /* Set Exponent parameter as 6 (MHZ) + * in struct iw_freq iwlist & iwconfig + * command shows frequency into proper + * format (2.412 GHz instead of 246.2 + * MHz) + */ + fwrq->m = freq; + fwrq->e = MHZ; } } else { /* Set Exponent parameter as 6 (MHZ) in struct iw_freq @@ -5020,23 +5020,22 @@ static int __iw_set_encodeext(struct net_device *dev, hdd_err("Invalid Configuration"); return -EINVAL; - } else { - /*Static wep, update the roam profile with the keys */ - if (ext->key_len - && (ext->key_len <= - eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) - && key_index < CSR_MAX_NUM_KEY) { - qdf_mem_copy(&pRoamProfile->Keys. - KeyMaterial[key_index][0], - ext->key, ext->key_len); - pRoamProfile->Keys.KeyLength[key_index] = - (uint8_t) ext->key_len; + } - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - pRoamProfile->Keys.defaultIndex = - (uint8_t) key_index; + /*Static wep, update the roam profile with the keys */ + if (ext->key_len && + (ext->key_len <= eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) && + key_index < CSR_MAX_NUM_KEY) { + qdf_mem_copy(&pRoamProfile->Keys. + KeyMaterial[key_index][0], + ext->key, ext->key_len); + pRoamProfile->Keys.KeyLength[key_index] = + (uint8_t) ext->key_len; + + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) + pRoamProfile->Keys.defaultIndex = + (uint8_t) key_index; - } } return ret; } diff --git a/core/hdd/src/wlan_hdd_wowl.c b/core/hdd/src/wlan_hdd_wowl.c index ada01b23af3c..9adba08421c1 100644 --- a/core/hdd/src/wlan_hdd_wowl.c +++ b/core/hdd/src/wlan_hdd_wowl.c @@ -336,9 +336,9 @@ bool hdd_add_wowl_ptrn_debugfs(hdd_adapter_t *pAdapter, uint8_t pattern_idx, hdd_err("Malformed WoW pattern!"); return false; - } else - pattern_len >>= 1; + } + pattern_len >>= 1; if (!pattern_len || pattern_len > WOWL_PTRN_MAX_SIZE) { hdd_err("WoW pattern length %d is out of range (1 ~ %d).", pattern_len, WOWL_PTRN_MAX_SIZE);