diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-05-16 14:55:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-16 19:32:19 -0400 |
commit | e00cf3b9eb7839b952e434a75bff6b99e47337ac (patch) | |
tree | ef583ab8ac09bf703026650d4bc7777e6a3864d3 /drivers/net/wireless/mwifiex | |
parent | 1a8218e96271790a07dd7065a2ef173e0f67e328 (diff) | |
parent | 3b8ab88acaceb505aa06ef3bbf3a73b92470ae78 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
net/mac80211/sta_info.h
Diffstat (limited to 'drivers/net/wireless/mwifiex')
22 files changed, 232 insertions, 492 deletions
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c index 1d294cfa6c9..916183d3900 100644 --- a/drivers/net/wireless/mwifiex/11n.c +++ b/drivers/net/wireless/mwifiex/11n.c @@ -187,7 +187,7 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, */ int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, void *data_buf) { - struct mwifiex_ds_11n_tx_cfg *tx_cfg = NULL; + struct mwifiex_ds_11n_tx_cfg *tx_cfg; struct host_cmd_ds_11n_cfg *htcfg = &resp->params.htcfg; if (data_buf) { @@ -274,7 +274,7 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp, void *data_buf) { - struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl = NULL; + struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl; struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl = &resp->params.amsdu_aggr_ctrl; @@ -461,8 +461,7 @@ mwifiex_cfg_tx_buf(struct mwifiex_private *priv, struct mwifiex_bssdescriptor *bss_desc) { u16 max_amsdu = MWIFIEX_TX_DATA_BUF_SIZE_2K; - u16 tx_buf = 0; - u16 curr_tx_buf_size = 0; + u16 tx_buf, curr_tx_buf_size = 0; if (bss_desc->bcn_ht_cap) { if (le16_to_cpu(bss_desc->bcn_ht_cap->cap_info) & diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index c9fb0627de4..d3d5e0853c4 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c @@ -60,7 +60,7 @@ mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr, * later with ethertype */ }; - struct tx_packet_hdr *tx_header = NULL; + struct tx_packet_hdr *tx_header; skb_put(skb_aggr, sizeof(*tx_header)); @@ -136,131 +136,6 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv, } /* - * Counts the number of subframes in an aggregate packet. - * - * This function parses an aggregate packet buffer, looking for - * subframes and counting the number of such subframe found. The - * function automatically skips the DA/SA fields at the beginning - * of each subframe and padding at the end. - */ -static int -mwifiex_11n_get_num_aggr_pkts(u8 *data, int total_pkt_len) -{ - int pkt_count = 0, pkt_len, pad; - - while (total_pkt_len > 0) { - /* Length will be in network format, change it to host */ - pkt_len = ntohs((*(__be16 *)(data + 2 * ETH_ALEN))); - pad = (((pkt_len + sizeof(struct ethhdr)) & 3)) ? - (4 - ((pkt_len + sizeof(struct ethhdr)) & 3)) : 0; - data += pkt_len + pad + sizeof(struct ethhdr); - total_pkt_len -= pkt_len + pad + sizeof(struct ethhdr); - ++pkt_count; - } - - return pkt_count; -} - -/* - * De-aggregate received packets. - * - * This function parses the received aggregate buffer, extracts each subframe, - * strips off the SNAP header from them and sends the data portion for further - * processing. - * - * Each subframe body is copied onto a separate buffer, which are freed by - * upper layer after processing. The function also performs sanity tests on - * the received buffer. - */ -int mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - u16 pkt_len; - int total_pkt_len; - u8 *data; - int pad; - struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); - struct rxpd *local_rx_pd = (struct rxpd *) skb->data; - struct sk_buff *skb_daggr; - struct mwifiex_rxinfo *rx_info_daggr = NULL; - int ret = -1; - struct rx_packet_hdr *rx_pkt_hdr; - struct mwifiex_adapter *adapter = priv->adapter; - u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; - - data = (u8 *) (local_rx_pd + local_rx_pd->rx_pkt_offset); - total_pkt_len = local_rx_pd->rx_pkt_length; - - /* Sanity test */ - if (total_pkt_len > MWIFIEX_RX_DATA_BUF_SIZE) { - dev_err(adapter->dev, "total pkt len greater than buffer" - " size %d\n", total_pkt_len); - return -1; - } - - rx_info->use_count = mwifiex_11n_get_num_aggr_pkts(data, total_pkt_len); - - while (total_pkt_len > 0) { - rx_pkt_hdr = (struct rx_packet_hdr *) data; - /* Length will be in network format, change it to host */ - pkt_len = ntohs((*(__be16 *) (data + 2 * ETH_ALEN))); - if (pkt_len > total_pkt_len) { - dev_err(adapter->dev, "pkt_len %d > total_pkt_len %d\n", - total_pkt_len, pkt_len); - break; - } - - pad = (((pkt_len + sizeof(struct ethhdr)) & 3)) ? - (4 - ((pkt_len + sizeof(struct ethhdr)) & 3)) : 0; - - total_pkt_len -= pkt_len + pad + sizeof(struct ethhdr); - - if (memcmp(&rx_pkt_hdr->rfc1042_hdr, - rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr)) == 0) { - memmove(data + LLC_SNAP_LEN, data, 2 * ETH_ALEN); - data += LLC_SNAP_LEN; - pkt_len += sizeof(struct ethhdr) - LLC_SNAP_LEN; - } else { - *(u16 *) (data + 2 * ETH_ALEN) = (u16) 0; - pkt_len += sizeof(struct ethhdr); - } - - skb_daggr = dev_alloc_skb(pkt_len); - if (!skb_daggr) { - dev_err(adapter->dev, "%s: failed to alloc skb_daggr\n", - __func__); - return -1; - } - rx_info_daggr = MWIFIEX_SKB_RXCB(skb_daggr); - - rx_info_daggr->bss_index = rx_info->bss_index; - skb_daggr->tstamp = skb->tstamp; - rx_info_daggr->parent = skb; - skb_daggr->priority = skb->priority; - skb_put(skb_daggr, pkt_len); - memcpy(skb_daggr->data, data, pkt_len); - - ret = mwifiex_recv_packet(adapter, skb_daggr); - - switch (ret) { - case -EINPROGRESS: - break; - case -1: - dev_err(adapter->dev, "deaggr: host_to_card failed\n"); - case 0: - mwifiex_recv_packet_complete(adapter, skb_daggr, ret); - break; - default: - break; - } - - data += pkt_len + pad; - } - - return ret; -} - -/* * Create aggregated packet. * * This function creates an aggregated MSDU packet, by combining buffers @@ -285,8 +160,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, struct mwifiex_adapter *adapter = priv->adapter; struct sk_buff *skb_aggr, *skb_src; struct mwifiex_txinfo *tx_info_aggr, *tx_info_src; - int pad = 0; - int ret = 0; + int pad = 0, ret; struct mwifiex_tx_param tx_param; struct txpd *ptx_pd = NULL; @@ -319,7 +193,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, else skb_src = NULL; - pra_list->total_pkts_size -= skb_src->len; + if (skb_src) + pra_list->total_pkts_size -= skb_src->len; spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); @@ -374,7 +249,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, (adapter->pps_uapsd_mode) && (adapter->tx_lock_flag)) { priv->adapter->tx_lock_flag = false; - ptx_pd->flags = 0; + if (ptx_pd) + ptx_pd->flags = 0; } skb_queue_tail(&pra_list->skb_head, skb_aggr); diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c index a93c03fdea8..e5dfdc39a92 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c @@ -39,7 +39,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv, *rx_reor_tbl_ptr, int start_win) { int no_pkt_to_send, i; - void *rx_tmp_ptr = NULL; + void *rx_tmp_ptr; unsigned long flags; no_pkt_to_send = (start_win > rx_reor_tbl_ptr->start_win) ? @@ -88,7 +88,7 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv, struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr) { int i, j, xchg; - void *rx_tmp_ptr = NULL; + void *rx_tmp_ptr; unsigned long flags; for (i = 0; i < rx_reor_tbl_ptr->win_size; ++i) { @@ -335,8 +335,8 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv, &cmd->params.add_ba_rsp; struct host_cmd_ds_11n_addba_req *cmd_addba_req = (struct host_cmd_ds_11n_addba_req *) data_buf; - u8 tid = 0; - int win_size = 0; + u8 tid; + int win_size; uint16_t block_ack_param_set; cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP); @@ -406,9 +406,8 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, u8 *ta, u8 pkt_type, void *payload) { struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; - int start_win, end_win, win_size; - int ret = 0; - u16 pkt_index = 0; + int start_win, end_win, win_size, ret; + u16 pkt_index; rx_reor_tbl_ptr = mwifiex_11n_get_rx_reorder_tbl((struct mwifiex_private *) priv, @@ -540,7 +539,7 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv, (struct host_cmd_ds_11n_addba_rsp *) &resp->params.add_ba_rsp; int tid, win_size; - struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr = NULL; + struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; uint16_t block_ack_param_set; block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set); diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 98009e2194c..660831ce293 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c @@ -77,18 +77,15 @@ mwifiex_channels_to_cfg80211_channel_type(int channel_type) static int mwifiex_is_alg_wep(u32 cipher) { - int alg = 0; - switch (cipher) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: - alg = 1; - break; + return 1; default: - alg = 0; break; } - return alg; + + return 0; } /* @@ -408,7 +405,7 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, static int mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr) { - int ret = 0; + int ret; if (frag_thr < MWIFIEX_FRAG_MIN_VALUE || frag_thr > MWIFIEX_FRAG_MAX_VALUE) @@ -449,7 +446,6 @@ static int mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) { struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); - int ret = 0; if (changed & WIPHY_PARAM_RTS_THRESHOLD) { @@ -473,7 +469,7 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { - int ret = 0; + int ret; struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); if (priv->bss_mode == type) { @@ -717,7 +713,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) { struct ieee80211_channel *chan; struct mwifiex_bss_info bss_info; - int ie_len = 0; + int ie_len; u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)]; if (mwifiex_get_bss_info(priv, &bss_info)) @@ -765,7 +761,6 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv, struct mwifiex_802_11_ssid *ssid) { - struct mwifiex_scan_resp scan_resp; struct mwifiex_bssdescriptor *scan_table; int i, j; struct ieee80211_channel *chan; @@ -775,10 +770,6 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv, int beacon_size; u8 element_id, element_len; - memset(&scan_resp, 0, sizeof(scan_resp)); - scan_resp.scan_table = (u8 *) priv->adapter->scan_table; - scan_resp.num_in_scan_table = priv->adapter->num_in_scan_table; - #define MAX_IE_BUF 2048 ie_buf = kzalloc(MAX_IE_BUF, GFP_KERNEL); if (!ie_buf) { @@ -787,8 +778,8 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv, return -ENOMEM; } - scan_table = (struct mwifiex_bssdescriptor *) scan_resp.scan_table; - for (i = 0; i < scan_resp.num_in_scan_table; i++) { + scan_table = priv->adapter->scan_table; + for (i = 0; i < priv->adapter->num_in_scan_table; i++) { if (ssid) { /* Inform specific BSS only */ if (memcmp(ssid->ssid, scan_table[i].ssid.ssid, @@ -903,8 +894,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, { struct mwifiex_802_11_ssid req_ssid; struct mwifiex_ssid_bssid ssid_bssid; - int ret = 0; - int auth_type = 0; + int ret, auth_type = 0; memset(&req_ssid, 0, sizeof(struct mwifiex_802_11_ssid)); memset(&ssid_bssid, 0, sizeof(struct mwifiex_ssid_bssid)); @@ -1044,7 +1034,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, goto done; } - priv->assoc_request = 1; + priv->assoc_request = -EINPROGRESS; wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", (char *) sme->ssid, sme->bssid); @@ -1052,6 +1042,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid, priv->bss_mode, sme->channel, sme, 0); + priv->assoc_request = 1; done: priv->assoc_result = ret; queue_work(priv->workqueue, &priv->cfg_workqueue); @@ -1080,7 +1071,7 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, goto done; } - priv->ibss_join_request = 1; + priv->ibss_join_request = -EINPROGRESS; wiphy_dbg(wiphy, "info: trying to join to %s and bssid %pM\n", (char *) params->ssid, params->bssid); @@ -1088,6 +1079,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, params->bssid, priv->bss_mode, params->channel, NULL, params->privacy); + + priv->ibss_join_request = 1; done: priv->ibss_join_result = ret; queue_work(priv->workqueue, &priv->cfg_workqueue); @@ -1244,8 +1237,8 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac, struct mwifiex_private *priv) { - int ret = 0; - void *wdev_priv = NULL; + int ret; + void *wdev_priv; struct wireless_dev *wdev; wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); @@ -1257,8 +1250,10 @@ int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac, wdev->wiphy = wiphy_new(&mwifiex_cfg80211_ops, sizeof(struct mwifiex_private *)); - if (!wdev->wiphy) + if (!wdev->wiphy) { + kfree(wdev); return -ENOMEM; + } wdev->iftype = NL80211_IFTYPE_STATION; wdev->wiphy->max_scan_ssids = 10; wdev->wiphy->interface_modes = @@ -1298,6 +1293,7 @@ int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac, dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n", __func__); wiphy_free(wdev->wiphy); + kfree(wdev); return ret; } else { dev_dbg(priv->adapter->dev, @@ -1380,7 +1376,7 @@ done: kfree(scan_req); } - if (priv->assoc_request) { + if (priv->assoc_request == 1) { if (!priv->assoc_result) { cfg80211_connect_result(priv->netdev, priv->cfg_bssid, NULL, 0, NULL, 0, @@ -1399,7 +1395,7 @@ done: priv->assoc_result = 0; } - if (priv->ibss_join_request) { + if (priv->ibss_join_request == 1) { if (!priv->ibss_join_result) { cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, GFP_KERNEL); diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 776146a104e..cd89fed206a 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c @@ -91,7 +91,7 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter, cmd_node->wait_q_enabled = false; if (cmd_node->resp_skb) { - mwifiex_recv_complete(adapter, cmd_node->resp_skb, 0); + dev_kfree_skb_any(cmd_node->resp_skb); cmd_node->resp_skb = NULL; } } @@ -128,7 +128,7 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, { struct mwifiex_adapter *adapter = priv->adapter; - int ret = 0; + int ret; struct host_cmd_ds_command *host_cmd; uint16_t cmd_code; uint16_t cmd_size; @@ -222,25 +222,24 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, */ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) { - int ret = 0; - u16 cmd_len = 0; + int ret; struct mwifiex_private *priv; - struct mwifiex_opt_sleep_confirm_buffer *sleep_cfm_buf = - (struct mwifiex_opt_sleep_confirm_buffer *) + struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = + (struct mwifiex_opt_sleep_confirm *) adapter->sleep_cfm->data; - cmd_len = sizeof(struct mwifiex_opt_sleep_confirm); priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - sleep_cfm_buf->ps_cfm_sleep.seq_num = + sleep_cfm_buf->seq_num = cpu_to_le16((HostCmd_SET_SEQ_NO_BSS_INFO (adapter->seq_num, priv->bss_num, priv->bss_type))); adapter->seq_num++; + skb_push(adapter->sleep_cfm, INTF_HEADER_LEN); ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, adapter->sleep_cfm->data, - adapter->sleep_cfm->len + - INTF_HEADER_LEN, NULL); + adapter->sleep_cfm->len, NULL); + skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN); if (ret == -1) { dev_err(adapter->dev, "SLEEP_CFM: failed\n"); @@ -249,14 +248,14 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) } if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY)) == MWIFIEX_BSS_ROLE_STA) { - if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl) + if (!sleep_cfm_buf->resp_ctrl) /* Response is not needed for sleep confirm command */ adapter->ps_state = PS_STATE_SLEEP; else adapter->ps_state = PS_STATE_SLEEP_CFM; - if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl + if (!sleep_cfm_buf->resp_ctrl && (adapter->is_hs_configured && !adapter->sleep_period.period)) { adapter->pm_wakeup_card_req = true; @@ -292,7 +291,7 @@ int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) if (!cmd_array) { dev_err(adapter->dev, "%s: failed to alloc cmd_array\n", __func__); - return -1; + return -ENOMEM; } adapter->cmd_pool = cmd_array; @@ -340,7 +339,7 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) } if (!cmd_array[i].resp_skb) continue; - mwifiex_recv_complete(adapter, cmd_array[i].resp_skb, 0); + dev_kfree_skb_any(cmd_array[i].resp_skb); } /* Release struct cmd_ctrl_node */ if (adapter->cmd_pool) { @@ -364,13 +363,13 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) */ int mwifiex_process_event(struct mwifiex_adapter *adapter) { - int ret = 0; + int ret; struct mwifiex_private *priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); struct sk_buff *skb = adapter->event_skb; u32 eventcause = adapter->event_cause; struct timeval tstamp; - struct mwifiex_rxinfo *rx_info = NULL; + struct mwifiex_rxinfo *rx_info; /* Save the last event to debug log */ adapter->dbg.last_event_index = @@ -403,7 +402,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) adapter->event_cause = 0; adapter->event_skb = NULL; - mwifiex_recv_complete(adapter, skb, 0); + dev_kfree_skb_any(skb); return ret; } @@ -446,10 +445,10 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no, int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no, u16 cmd_action, u32 cmd_oid, void *data_buf) { - int ret = 0; + int ret; struct mwifiex_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *cmd_node = NULL; - struct host_cmd_ds_command *cmd_ptr = NULL; + struct cmd_ctrl_node *cmd_node; + struct host_cmd_ds_command *cmd_ptr; if (!adapter) { pr_err("PREP_CMD: adapter is NULL\n"); @@ -605,8 +604,8 @@ mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, */ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) { - struct mwifiex_private *priv = NULL; - struct cmd_ctrl_node *cmd_node = NULL; + struct mwifiex_private *priv; + struct cmd_ctrl_node *cmd_node; int ret = 0; struct host_cmd_ds_command *host_cmd; unsigned long cmd_flags; @@ -673,7 +672,7 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) */ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) { - struct host_cmd_ds_command *resp = NULL; + struct host_cmd_ds_command *resp; struct mwifiex_private *priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); int ret = 0; @@ -805,7 +804,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context) { struct mwifiex_adapter *adapter = (struct mwifiex_adapter *) function_context; - struct cmd_ctrl_node *cmd_node = NULL; + struct cmd_ctrl_node *cmd_node; struct timeval tstamp; adapter->num_cmd_timeout++; @@ -877,7 +876,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context) void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) { - struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; + struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; unsigned long flags; /* Cancel current cmd */ @@ -1160,7 +1159,7 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv, { struct host_cmd_ds_802_11_ps_mode_enh *psmode_enh = &cmd->params.psmode_enh; - u8 *tlv = NULL; + u8 *tlv; u16 cmd_size = 0; cmd->command = cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c index 7ddcb062f10..46d65e02c7b 100644 --- a/drivers/net/wireless/mwifiex/debugfs.c +++ b/drivers/net/wireless/mwifiex/debugfs.c @@ -193,7 +193,7 @@ mwifiex_info_read(struct file *file, char __user *ubuf, unsigned long page = get_zeroed_page(GFP_KERNEL); char *p = (char *) page, fmt[64]; struct mwifiex_bss_info info; - ssize_t ret = 0; + ssize_t ret; int i = 0; if (!p) @@ -288,7 +288,7 @@ mwifiex_getlog_read(struct file *file, char __user *ubuf, (struct mwifiex_private *) file->private_data; unsigned long page = get_zeroed_page(GFP_KERNEL); char *p = (char *) page; - ssize_t ret = 0; + ssize_t ret; struct mwifiex_ds_get_stats stats; if (!p) @@ -400,7 +400,7 @@ mwifiex_debug_read(struct file *file, char __user *ubuf, struct mwifiex_debug_data *d = &items[0]; unsigned long page = get_zeroed_page(GFP_KERNEL); char *p = (char *) page; - ssize_t ret = 0; + ssize_t ret; size_t size, addr; long val; int i, j; @@ -507,7 +507,7 @@ mwifiex_regrdwr_write(struct file *file, unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *) addr; size_t buf_size = min(count, (size_t) (PAGE_SIZE - 1)); - int ret = 0; + int ret; u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX; if (!buf) @@ -650,7 +650,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, (struct mwifiex_private *) file->private_data; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *) addr; - int pos = 0, ret = 0, i = 0; + int pos = 0, ret = 0, i; u8 value[MAX_EEPROM_DATA]; if (!buf) diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 6d1c4545eda..afdd145dff0 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h @@ -816,14 +816,7 @@ struct host_cmd_ds_txpwr_cfg { struct mwifiex_scan_cmd_config { /* - * BSS Type to be sent in the firmware command - * - * Field can be used to restrict the types of networks returned in the - * scan. Valid settings are: - * - * - MWIFIEX_SCAN_MODE_BSS (infrastructure) - * - MWIFIEX_SCAN_MODE_IBSS (adhoc) - * - MWIFIEX_SCAN_MODE_ANY (unrestricted, adhoc and infrastructure) + * BSS mode to be sent in the firmware command */ u8 bss_mode; @@ -866,13 +859,6 @@ struct mwifiex_user_scan_cfg { u8 keep_previous_scan; /* * BSS mode to be sent in the firmware command - * - * Field can be used to restrict the types of networks returned in the - * scan. Valid settings are: - * - * - MWIFIEX_SCAN_MODE_BSS (infrastructure) - * - MWIFIEX_SCAN_MODE_IBSS (adhoc) - * - MWIFIEX_SCAN_MODE_ANY (unrestricted, adhoc and infrastructure) */ u8 bss_mode; /* Configure the number of probe requests for active chan scans */ @@ -1198,9 +1184,4 @@ struct mwifiex_opt_sleep_confirm { __le16 action; __le16 resp_ctrl; } __packed; - -struct mwifiex_opt_sleep_confirm_buffer { - u8 hdr[4]; - struct mwifiex_opt_sleep_confirm ps_cfm_sleep; -} __packed; #endif /* !_MWIFIEX_FW_H_ */ diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index fc2c0c5728d..3f1559e6132 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c @@ -41,7 +41,7 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv) if (!bss_prio) { dev_err(adapter->dev, "%s: failed to alloc bss_prio\n", __func__); - return -1; + return -ENOMEM; } bss_prio->priv = priv; @@ -151,7 +151,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv) */ static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) { - int ret = 0; + int ret; u32 buf_size; struct mwifiex_bssdescriptor *temp_scan_table; @@ -161,7 +161,7 @@ static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) if (!temp_scan_table) { dev_err(adapter->dev, "%s: failed to alloc temp_scan_table\n", __func__); - return -1; + return -ENOMEM; } adapter->scan_table = temp_scan_table; @@ -175,7 +175,7 @@ static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) } adapter->sleep_cfm = - dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm_buffer) + dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm) + INTF_HEADER_LEN); if (!adapter->sleep_cfm) { @@ -197,10 +197,10 @@ static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) */ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) { - struct mwifiex_opt_sleep_confirm_buffer *sleep_cfm_buf = NULL; + struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = NULL; - skb_put(adapter->sleep_cfm, sizeof(sleep_cfm_buf->ps_cfm_sleep)); - sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm_buffer *) + skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); + sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *) (adapter->sleep_cfm->data); adapter->cmd_sent = false; @@ -268,16 +268,14 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) mwifiex_wmm_init(adapter); if (adapter->sleep_cfm) { - memset(&sleep_cfm_buf->ps_cfm_sleep, 0, - adapter->sleep_cfm->len); - sleep_cfm_buf->ps_cfm_sleep.command = - cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); - sleep_cfm_buf->ps_cfm_sleep.size = - cpu_to_le16(adapter->sleep_cfm->len); - sleep_cfm_buf->ps_cfm_sleep.result = 0; - sleep_cfm_buf->ps_cfm_sleep.action = cpu_to_le16(SLEEP_CONFIRM); - sleep_cfm_buf->ps_cfm_sleep.resp_ctrl = - cpu_to_le16(RESP_NEEDED); + memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); + sleep_cfm_buf->command = + cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); + sleep_cfm_buf->size = + cpu_to_le16(adapter->sleep_cfm->len); + sleep_cfm_buf->result = 0; + sleep_cfm_buf->action = cpu_to_le16(SLEEP_CONFIRM); + sleep_cfm_buf->resp_ctrl = cpu_to_le16(RESP_NEEDED); } memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params)); memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period)); @@ -342,9 +340,8 @@ mwifiex_free_adapter(struct mwifiex_adapter *adapter) */ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) { - struct mwifiex_private *priv = NULL; - s32 i = 0; - u32 j = 0; + struct mwifiex_private *priv; + s32 i, j; spin_lock_init(&adapter->mwifiex_lock); spin_lock_init(&adapter->int_lock); @@ -400,9 +397,8 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) */ void mwifiex_free_lock_list(struct mwifiex_adapter *adapter) { - struct mwifiex_private *priv = NULL; - s32 i = 0; - s32 j = 0; + struct mwifiex_private *priv; + s32 i, j; /* Free lists */ list_del(&adapter->cmd_free_q); @@ -436,10 +432,9 @@ void mwifiex_free_lock_list(struct mwifiex_adapter *adapter) */ int mwifiex_init_fw(struct mwifiex_adapter *adapter) { - int ret = 0; - struct mwifiex_private *priv = NULL; - u8 i = 0; - u8 first_sta = true; + int ret; + struct mwifiex_private *priv; + u8 i, first_sta = true; int is_cmd_pend_q_empty; unsigned long flags; @@ -497,8 +492,7 @@ static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv) { int i; struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_bss_prio_node *bssprio_node = NULL, *tmp_node = NULL, - **cur = NULL; + struct mwifiex_bss_prio_node *bssprio_node, *tmp_node, **cur; struct list_head *head; spinlock_t *lock; unsigned long flags; @@ -552,8 +546,8 @@ int mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) { int ret = -EINPROGRESS; - struct mwifiex_private *priv = NULL; - s32 i = 0; + struct mwifiex_private *priv; + s32 i; unsigned long flags; /* mwifiex already shutdown */ @@ -608,9 +602,8 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, struct mwifiex_fw_image *pmfw) { - int ret = 0; + int ret, winner; u32 poll_num = 1; - int winner; /* Check if firmware is already running */ ret = adapter->if_ops.check_fw_status(adapter, poll_num, &winner); diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index 5488e111fd2..7c1c5ee40eb 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h @@ -23,49 +23,16 @@ #include <net/mac80211.h> enum { - MWIFIEX_SCAN_MODE_UNCHANGED = 0, - MWIFIEX_SCAN_MODE_BSS, - MWIFIEX_SCAN_MODE_IBSS, - MWIFIEX_SCAN_MODE_ANY -}; - -enum { MWIFIEX_SCAN_TYPE_UNCHANGED = 0, MWIFIEX_SCAN_TYPE_ACTIVE, MWIFIEX_SCAN_TYPE_PASSIVE }; -struct mwifiex_get_scan_table_fixed { - u8 bssid[ETH_ALEN]; - u8 channel; - u8 rssi; - long long network_tsf; -}; - -struct mwifiex_scan_time_params { - u32 specific_scan_time; - u32 active_scan_time; - u32 passive_scan_time; -}; - struct mwifiex_user_scan { u32 scan_cfg_len; u8 scan_cfg_buf[1]; }; -struct mwifiex_scan_req { - u32 scan_mode; - u32 scan_type; - struct mwifiex_802_11_ssid scan_ssid; - struct mwifiex_scan_time_params scan_time; - struct mwifiex_user_scan user_scan; -}; - -struct mwifiex_scan_resp { - u32 num_in_scan_table; - u8 *scan_table; -}; - #define MWIFIEX_PROMISC_MODE 1 #define MWIFIEX_MULTICAST_MODE 2 #define MWIFIEX_ALL_MULTI_MODE 4 @@ -77,18 +44,11 @@ struct mwifiex_multicast_list { u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; }; -#define MWIFIEX_MAX_CHANNEL_NUM 128 - struct mwifiex_chan_freq { u32 channel; u32 freq; }; -struct mwifiex_chan_list { - u32 num_of_chan; - struct mwifiex_chan_freq cf[MWIFIEX_MAX_CHANNEL_NUM]; -}; - struct mwifiex_ssid_bssid { struct mwifiex_802_11_ssid ssid; u8 bssid[ETH_ALEN]; @@ -136,18 +96,8 @@ struct mwifiex_ds_get_stats { u32 wep_icv_error[4]; }; -#define BCN_RSSI_LAST_MASK 0x00000001 #define BCN_RSSI_AVG_MASK 0x00000002 -#define DATA_RSSI_LAST_MASK 0x00000004 -#define DATA_RSSI_AVG_MASK 0x00000008 -#define BCN_SNR_LAST_MASK 0x00000010 -#define BCN_SNR_AVG_MASK 0x00000020 -#define DATA_SNR_LAST_MASK 0x00000040 -#define DATA_SNR_AVG_MASK 0x00000080 -#define BCN_NF_LAST_MASK 0x00000100 #define BCN_NF_AVG_MASK 0x00000200 -#define DATA_NF_LAST_MASK 0x00000400 -#define DATA_NF_AVG_MASK 0x00000800 #define ALL_RSSI_INFO_MASK 0x00000fff struct mwifiex_ds_get_signal { @@ -174,11 +124,6 @@ struct mwifiex_ds_get_signal { s16 data_nf_avg; }; -struct mwifiex_fw_info { - u32 fw_ver; - u8 mac_addr[ETH_ALEN]; -}; - #define MWIFIEX_MAX_VER_STR_LEN 128 struct mwifiex_ver_ext { @@ -286,11 +231,6 @@ struct mwifiex_rate_cfg { u32 rate; }; -struct mwifiex_data_rate { - u32 tx_data_rate; - u32 rx_data_rate; -}; - struct mwifiex_power_cfg { u32 is_power_auto; u32 power_level; @@ -309,21 +249,14 @@ struct mwifiex_ds_hs_cfg { }; #define DEEP_SLEEP_ON 1 -#define DEEP_SLEEP_OFF 0 - #define DEEP_SLEEP_IDLE_TIME 100 +#define PS_MODE_AUTO 1 struct mwifiex_ds_auto_ds { u16 auto_ds; u16 idle_time; }; -#define PS_MODE_UNCHANGED 0 -#define PS_MODE_AUTO 1 -#define PS_MODE_POLL 2 -#define PS_MODE_NULL 3 - - struct mwifiex_ds_pm_cfg { union { u32 ps_mode; @@ -333,18 +266,6 @@ struct mwifiex_ds_pm_cfg { } param; }; -struct mwifiex_ioctl_wmm_queue_status_ac { - u8 wmm_acm; - u8 flow_required; - u8 flow_created; - u8 disabled; -}; - -struct mwifiex_ds_wmm_queue_status { - struct mwifiex_ioctl_wmm_queue_status_ac - ac_status[IEEE80211_MAX_QUEUES]; -}; - struct mwifiex_ds_11n_tx_cfg { u16 tx_htcap; u16 tx_htinfo; diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 85fca5eb419..5eab3dc29b1 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c @@ -143,9 +143,8 @@ mwifiex_cmd_append_tsf_tlv(struct mwifiex_private *priv, u8 **buffer, static int mwifiex_get_common_rates(struct mwifiex_private *priv, u8 *rate1, u32 rate1_size, u8 *rate2, u32 rate2_size) { - int ret = 0; - u8 *ptr = rate1; - u8 *tmp = NULL; + int ret; + u8 *ptr = rate1, *tmp; u32 i, j; tmp = kmalloc(rate1_size, GFP_KERNEL); @@ -203,7 +202,7 @@ mwifiex_setup_rates_from_bssdesc(struct mwifiex_private *priv, u8 *out_rates, u32 *out_rates_size) { u8 card_rates[MWIFIEX_SUPPORTED_RATES]; - u32 card_rates_size = 0; + u32 card_rates_size; /* Copy AP supported rates */ memcpy(out_rates, bss_desc->supported_rates, MWIFIEX_SUPPORTED_RATES); @@ -1359,7 +1358,7 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv, static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac) { u8 mac_address[ETH_ALEN]; - int ret = 0; + int ret; u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 }; if (mac) { diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index d16cea770fa..f0582259c93 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c @@ -69,7 +69,7 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, adapter = kzalloc(sizeof(struct mwifiex_adapter), GFP_KERNEL); if (!adapter) - return -1; + return -ENOMEM; g_adapter = adapter; adapter->card = card; @@ -150,7 +150,7 @@ error: */ static int mwifiex_unregister(struct mwifiex_adapter *adapter) { - s32 i = 0; + s32 i; del_timer(&adapter->cmd_timer); @@ -379,8 +379,7 @@ static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) */ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter) { - int ret = 0; - int err; + int ret, err; struct mwifiex_fw_image fw; memset(&fw, 0, sizeof(struct mwifiex_fw_image)); @@ -449,7 +448,7 @@ done: static void mwifiex_fill_buffer(struct sk_buff *skb) { - struct ethhdr *eth = NULL; + struct ethhdr *eth; struct iphdr *iph; struct timeval tv; u8 tid = 0; @@ -510,20 +509,20 @@ static int mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - struct sk_buff *new_skb = NULL; + struct sk_buff *new_skb; struct mwifiex_txinfo *tx_info; dev_dbg(priv->adapter->dev, "data: %lu BSS(%d): Data <= kernel\n", jiffies, priv->bss_index); if (priv->adapter->surprise_removed) { - kfree(skb); + kfree_skb(skb); priv->stats.tx_dropped++; return 0; } if (!skb->len || (skb->len > ETH_FRAME_LEN)) { dev_err(priv->adapter->dev, "Tx: bad skb len %d\n", skb->len); - kfree(skb); + kfree_skb(skb); priv->stats.tx_dropped++; return 0; } @@ -536,7 +535,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) skb_realloc_headroom(skb, MWIFIEX_MIN_DATA_HEADER_LEN); if (unlikely(!new_skb)) { dev_err(priv->adapter->dev, "Tx: cannot alloca new_skb\n"); - kfree(skb); + kfree_skb(skb); priv->stats.tx_dropped++; return 0; } @@ -571,7 +570,7 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct sockaddr *hw_addr = (struct sockaddr *) addr; - int ret = 0; + int ret; memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN); @@ -696,9 +695,9 @@ static struct mwifiex_private *mwifiex_add_interface( struct mwifiex_adapter *adapter, u8 bss_index, u8 bss_type) { - struct net_device *dev = NULL; - struct mwifiex_private *priv = NULL; - void *mdev_priv = NULL; + struct net_device *dev; + struct mwifiex_private *priv; + void *mdev_priv; dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), "mlan%d", ether_setup, 1); @@ -759,7 +758,7 @@ error: static void mwifiex_remove_interface(struct mwifiex_adapter *adapter, u8 bss_index) { - struct net_device *dev = NULL; + struct net_device *dev; struct mwifiex_private *priv = adapter->priv[bss_index]; if (!priv) diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 5043fcd2256..672701dc272 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h @@ -479,9 +479,9 @@ struct mwifiex_private { u8 report_scan_result; struct cfg80211_scan_request *scan_request; int scan_result_status; - bool assoc_request; + int assoc_request; u16 assoc_result; - bool ibss_join_request; + int ibss_join_request; u16 ibss_join_result; bool disconnect; u8 cfg_bssid[6]; @@ -692,10 +692,6 @@ int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter); int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *); -int mwifiex_recv_complete(struct mwifiex_adapter *, - struct sk_buff *skb, - int status); - int mwifiex_recv_packet(struct mwifiex_adapter *, struct sk_buff *skb); int mwifiex_process_event(struct mwifiex_adapter *adapter); diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 31a52957880..5c22860fb40 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c @@ -117,8 +117,8 @@ mwifiex_search_oui_in_ie(struct ie_body *iebody, u8 *oui) static u8 mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) { - u8 *oui = NULL; - struct ie_body *iebody = NULL; + u8 *oui; + struct ie_body *iebody; u8 ret = MWIFIEX_OUI_NOT_PRESENT; if (((bss_desc->bcn_rsn_ie) && ((*(bss_desc->bcn_rsn_ie)). @@ -144,8 +144,8 @@ mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) static u8 mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) { - u8 *oui = NULL; - struct ie_body *iebody = NULL; + u8 *oui; + struct ie_body *iebody; u8 ret = MWIFIEX_OUI_NOT_PRESENT; if (((bss_desc->bcn_wpa_ie) && ((*(bss_desc->bcn_wpa_ie)). @@ -181,7 +181,7 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv, struct mwifiex_ssid_bssid *ssid_bssid) { struct mwifiex_ssid_bssid tmp_ssid_bssid; - u8 *mac = NULL; + u8 *mac; if (!ssid_bssid) return -1; @@ -213,7 +213,7 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv, int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv, struct mwifiex_user_scan_cfg *scan_req) { - int status = 0; + int status; priv->adapter->cmd_wait_q.condition = false; @@ -2253,8 +2253,8 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, { int ret = 0; struct mwifiex_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *cmd_node = NULL; - union mwifiex_scan_cmd_config_tlv *scan_cfg_out = NULL; + struct cmd_ctrl_node *cmd_node; + union mwifiex_scan_cmd_config_tlv *scan_cfg_out; struct mwifiex_ie_types_chan_list_param_set *chan_list_out; u32 buf_size; struct mwifiex_chan_scan_param_set *scan_chan_list; @@ -2283,7 +2283,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, GFP_KERNEL); if (!scan_cfg_out) { dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); - return -1; + return -ENOMEM; } buf_size = sizeof(struct mwifiex_chan_scan_param_set) * @@ -2292,7 +2292,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, if (!scan_chan_list) { dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); kfree(scan_cfg_out); - return -1; + return -ENOMEM; } keep_previous_scan = false; @@ -2404,8 +2404,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, { int ret = 0; struct mwifiex_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *cmd_node = NULL; - struct host_cmd_ds_802_11_scan_rsp *scan_rsp = NULL; + struct cmd_ctrl_node *cmd_node; + struct host_cmd_ds_802_11_scan_rsp *scan_rsp; struct mwifiex_bssdescriptor *bss_new_entry = NULL; struct mwifiex_ie_types_data *tlv_data; struct mwifiex_ie_types_tsf_timestamp *tsf_tlv; @@ -2491,7 +2491,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, GFP_KERNEL); if (!bss_new_entry) { dev_err(adapter->dev, " failed to alloc bss_new_entry\n"); - return -1; + return -ENOMEM; } for (idx = 0; idx < scan_rsp->number_of_sets && bytes_left; idx++) { @@ -2881,7 +2881,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); if (!scan_cfg) { dev_err(adapter->dev, "failed to alloc scan_cfg\n"); - return -1; + return -ENOMEM; } memcpy(scan_cfg->ssid_list[0].ssid, req_ssid->ssid, @@ -2906,7 +2906,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, int mwifiex_request_scan(struct mwifiex_private *priv, struct mwifiex_802_11_ssid *req_ssid) { - int ret = 0; + int ret; if (down_interruptible(&priv->async_sem)) { dev_err(priv->adapter->dev, "%s: acquire semaphore\n", diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index 5148d0e0fad..d425dbd91d1 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c @@ -46,7 +46,7 @@ static struct semaphore add_remove_card_sem; static int mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { - int ret = 0; + int ret; struct sdio_mmc_card *card = NULL; pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n", @@ -68,6 +68,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) if (ret) { pr_err("%s: failed to enable function\n", __func__); + kfree(card); return -EIO; } @@ -119,7 +120,7 @@ static int mwifiex_sdio_suspend(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); struct sdio_mmc_card *card; - struct mwifiex_adapter *adapter = NULL; + struct mwifiex_adapter *adapter; mmc_pm_flag_t pm_flag = 0; int hs_actived = 0; int i; @@ -177,7 +178,7 @@ static int mwifiex_sdio_resume(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); struct sdio_mmc_card *card; - struct mwifiex_adapter *adapter = NULL; + struct mwifiex_adapter *adapter; mmc_pm_flag_t pm_flag = 0; int i; @@ -420,7 +421,7 @@ static int mwifiex_write_data_to_card(struct mwifiex_adapter *adapter, u8 *payload, u32 pkt_len, u32 port) { u32 i = 0; - int ret = 0; + int ret; do { ret = mwifiex_write_data_sync(adapter, payload, pkt_len, port); @@ -531,7 +532,7 @@ static int mwifiex_sdio_poll_card_status(struct mwifiex_adapter *adapter, u8 bits) { u32 tries; - u32 cs = 0; + u32 cs; for (tries = 0; tries < MAX_POLL_TRIES; tries++) { if (mwifiex_read_reg(adapter, CARD_STATUS_REG, &cs)) @@ -553,7 +554,7 @@ mwifiex_sdio_poll_card_status(struct mwifiex_adapter *adapter, u8 bits) static int mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) { - u32 fws0 = 0, fws1 = 0; + u32 fws0, fws1; if (mwifiex_read_reg(adapter, CARD_FW_STATUS0_REG, &fws0)) return -1; @@ -574,7 +575,7 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) */ static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) { - u32 host_int_mask = 0; + u32 host_int_mask; /* Read back the host_int_mask register */ if (mwifiex_read_reg(adapter, HOST_INT_MASK_REG, &host_int_mask)) @@ -614,7 +615,7 @@ static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter, u32 *type, u8 *buffer, u32 npayload, u32 ioport) { - int ret = 0; + int ret; u32 nb; if (!buffer) { @@ -652,14 +653,14 @@ static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter, static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, struct mwifiex_fw_image *fw) { - int ret = 0; + int ret; u8 *firmware = fw->fw_buf; u32 firmware_len = fw->fw_len; u32 offset = 0; u32 base0, base1; u8 *fwbuf; u16 len = 0; - u32 txlen = 0, tx_blocks = 0, tries = 0; + u32 txlen, tx_blocks = 0, tries; u32 i = 0; if (!firmware_len) { @@ -676,7 +677,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, if (!fwbuf) { dev_err(adapter->dev, "unable to alloc buffer for firmware." " Terminating download\n"); - return -1; + return -ENOMEM; } /* Perform firmware data transfer */ @@ -830,7 +831,7 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) { struct sdio_mmc_card *card = adapter->card; - u32 sdio_ireg = 0; + u32 sdio_ireg; unsigned long flags; if (mwifiex_read_data_sync(adapter, card->mp_regs, MAX_MP_REGS, @@ -964,7 +965,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter, s32 f_do_rx_cur = 0; s32 f_aggr_cur = 0; struct sk_buff *skb_deaggr; - u32 pind = 0; + u32 pind; u32 pkt_len, pkt_type = 0; u8 *curr_ptr; u32 rx_len = skb->len; @@ -1114,7 +1115,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) struct sdio_mmc_card *card = adapter->card; int ret = 0; u8 sdio_ireg; - struct sk_buff *skb = NULL; + struct sk_buff *skb; u8 port = CTRL_PORT; u32 len_reg_l, len_reg_u; u32 rx_blocks; @@ -1377,7 +1378,7 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter, struct mwifiex_tx_param *tx_param) { struct sdio_mmc_card *card = adapter->card; - int ret = 0; + int ret; u32 buf_block_len; u32 blk_size; u8 port = CTRL_PORT; @@ -1560,7 +1561,7 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) { struct sdio_mmc_card *card = adapter->card; int ret; - u32 sdio_ireg = 0; + u32 sdio_ireg; /* * Read the HOST_INT_STATUS_REG for ACK the first interrupt got @@ -1605,7 +1606,7 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) card->mp_regs = kzalloc(MAX_MP_REGS, GFP_KERNEL); if (!card->mp_regs) { dev_err(adapter->dev, "failed to alloc mp_regs\n"); - return -1; + return -ENOMEM; } ret = mwifiex_alloc_sdio_mpa_buffers(adapter, diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index 33c8ba1f5e3..8af3a78d272 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c @@ -274,8 +274,8 @@ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv, static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd, u16 cmd_action, void *data_buf) { - struct mwifiex_types_power_group *pg_tlv = NULL; - struct host_cmd_ds_txpwr_cfg *txp = NULL; + struct mwifiex_types_power_group *pg_tlv; + struct host_cmd_ds_txpwr_cfg *txp; struct host_cmd_ds_txpwr_cfg *cmd_txp_cfg = &cmd->params.txp_cfg; cmd->command = cpu_to_le16(HostCmd_CMD_TXPWR_CFG); @@ -478,7 +478,7 @@ mwifiex_set_keyparamset_wep(struct mwifiex_private *priv, struct mwifiex_ie_type_key_param_set *key_param_set, u16 *key_param_len) { - int cur_key_param_len = 0; + int cur_key_param_len; u8 i; /* Multi-key_param_set TLV is supported */ @@ -1121,7 +1121,7 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, */ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) { - int ret = 0; + int ret; u16 enable = true; struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl; struct mwifiex_ds_auto_ds auto_ds; diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index 7f4f10b752f..d08f76429a0 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c @@ -43,7 +43,7 @@ static void mwifiex_process_cmdresp_error(struct mwifiex_private *priv, struct host_cmd_ds_command *resp) { - struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; + struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_802_11_ps_mode_enh *pm; unsigned long flags; @@ -124,7 +124,7 @@ static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, { struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = &resp->params.rssi_info_rsp; - struct mwifiex_ds_get_signal *signal = NULL; + struct mwifiex_ds_get_signal *signal; priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); @@ -232,7 +232,7 @@ static int mwifiex_ret_get_log(struct mwifiex_private *priv, { struct host_cmd_ds_802_11_get_log *get_log = (struct host_cmd_ds_802_11_get_log *) &resp->params.get_log; - struct mwifiex_ds_get_stats *stats = NULL; + struct mwifiex_ds_get_stats *stats; if (data_buf) { stats = (struct mwifiex_ds_get_stats *) data_buf; @@ -280,10 +280,10 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *resp, void *data_buf) { - struct mwifiex_rate_cfg *ds_rate = NULL; + struct mwifiex_rate_cfg *ds_rate; struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; struct mwifiex_rate_scope *rate_scope; - struct mwifiex_ie_types_header *head = NULL; + struct mwifiex_ie_types_header *head; u16 tlv, tlv_buf_len; u8 *tlv_buf; u32 i; @@ -368,9 +368,9 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, */ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) { - int length = -1, max_power = -1, min_power = -1; - struct mwifiex_types_power_group *pg_tlv_hdr = NULL; - struct mwifiex_power_group *pg = NULL; + int length, max_power = -1, min_power = -1; + struct mwifiex_types_power_group *pg_tlv_hdr; + struct mwifiex_power_group *pg; if (data_buf) { pg_tlv_hdr = @@ -418,8 +418,8 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, { struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg; - struct mwifiex_types_power_group *pg_tlv_hdr = NULL; - struct mwifiex_power_group *pg = NULL; + struct mwifiex_types_power_group *pg_tlv_hdr; + struct mwifiex_power_group *pg; u16 action = le16_to_cpu(txp_cfg->action); switch (action) { @@ -593,7 +593,7 @@ static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv, &resp->params.domain_info_resp; struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain; u16 action = le16_to_cpu(domain_info->action); - u8 no_of_triplet = 0; + u8 no_of_triplet; no_of_triplet = (u8) ((le16_to_cpu(domain->header.len) - IEEE80211_COUNTRY_STRING_LEN) / @@ -661,7 +661,7 @@ static int mwifiex_ret_ver_ext(struct mwifiex_private *priv, void *data_buf) { struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext; - struct host_cmd_ds_version_ext *version_ext = NULL; + struct host_cmd_ds_version_ext *version_ext; if (data_buf) { version_ext = (struct host_cmd_ds_version_ext *)data_buf; @@ -682,8 +682,8 @@ static int mwifiex_ret_ver_ext(struct mwifiex_private *priv, static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp, void *data_buf) { - struct mwifiex_ds_reg_rw *reg_rw = NULL; - struct mwifiex_ds_read_eeprom *eeprom = NULL; + struct mwifiex_ds_reg_rw *reg_rw; + struct mwifiex_ds_read_eeprom *eeprom; if (data_buf) { reg_rw = (struct mwifiex_ds_reg_rw *) data_buf; diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index e7adaab3522..d05907d0503 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c @@ -149,7 +149,7 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, int mwifiex_bss_start(struct mwifiex_private *priv, struct mwifiex_ssid_bssid *ssid_bssid) { - int ret = 0; + int ret; struct mwifiex_adapter *adapter = priv->adapter; s32 i = -1; @@ -376,7 +376,7 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv, { struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_bssdescriptor *bss_desc; - s32 tbl_idx = 0; + s32 tbl_idx; if (!info) return -1; @@ -436,9 +436,8 @@ int mwifiex_set_radio_band_cfg(struct mwifiex_private *priv, struct mwifiex_ds_band_cfg *radio_cfg) { struct mwifiex_adapter *adapter = priv->adapter; - u8 infra_band = 0; - u8 adhoc_band = 0; - u32 adhoc_channel = 0; + u8 infra_band, adhoc_band; + u32 adhoc_channel; infra_band = (u8) radio_cfg->config_bands; adhoc_band = (u8) radio_cfg->adhoc_start_band; @@ -636,7 +635,7 @@ int mwifiex_bss_ioctl_find_bss(struct mwifiex_private *priv, int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel) { - int ret = 0; + int ret; struct mwifiex_bss_info bss_info; struct mwifiex_ssid_bssid ssid_bssid; u16 curr_chan = 0; @@ -755,11 +754,10 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv, struct mwifiex_rate_cfg *rate_cfg) { u8 rates[MWIFIEX_SUPPORTED_RATES]; - u8 *rate = NULL; - int rate_index = 0; + u8 *rate; + int rate_index, ret; u16 bitmap_rates[MAX_BITMAP_RATES_SIZE]; - u32 i = 0; - int ret = 0; + u32 i; struct mwifiex_adapter *adapter = priv->adapter; if (rate_cfg->is_rate_auto) { @@ -819,7 +817,7 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv, static int mwifiex_rate_ioctl_cfg(struct mwifiex_private *priv, struct mwifiex_rate_cfg *rate_cfg) { - int status = 0; + int status; if (!rate_cfg) return -1; @@ -841,7 +839,7 @@ static int mwifiex_rate_ioctl_cfg(struct mwifiex_private *priv, int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, struct mwifiex_rate_cfg *rate) { - int ret = 0; + int ret; memset(rate, 0, sizeof(struct mwifiex_rate_cfg)); rate->action = HostCmd_ACT_GEN_GET; @@ -875,11 +873,11 @@ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, int mwifiex_set_tx_power(struct mwifiex_private *priv, struct mwifiex_power_cfg *power_cfg) { - int ret = 0; - struct host_cmd_ds_txpwr_cfg *txp_cfg = NULL; - struct mwifiex_types_power_group *pg_tlv = NULL; - struct mwifiex_power_group *pg = NULL; - u8 *buf = NULL; + int ret; + struct host_cmd_ds_txpwr_cfg *txp_cfg; + struct mwifiex_types_power_group *pg_tlv; + struct mwifiex_power_group *pg; + u8 *buf; u16 dbm = 0; if (!power_cfg->is_power_auto) { @@ -897,7 +895,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, if (!buf) { dev_err(priv->adapter->dev, "%s: failed to alloc cmd buffer\n", __func__); - return -1; + return -ENOMEM; } txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf; @@ -960,7 +958,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, */ int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode) { - int ret = 0; + int ret; struct mwifiex_adapter *adapter = priv->adapter; u16 sub_cmd; @@ -1078,8 +1076,8 @@ static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_private *priv, static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv, struct mwifiex_ds_encrypt_key *encrypt_key) { - int ret = 0; - struct mwifiex_wep_key *wep_key = NULL; + int ret; + struct mwifiex_wep_key *wep_key; int index; if (priv->wep_key_curr_index >= NUM_WEP_KEYS) @@ -1142,7 +1140,7 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv, static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_private *priv, struct mwifiex_ds_encrypt_key *encrypt_key) { - int ret = 0; + int ret; u8 remove_key = false; struct host_cmd_ds_802_11_key_material *ibss_key; @@ -1209,7 +1207,7 @@ static int mwifiex_sec_ioctl_encrypt_key(struct mwifiex_private *priv, struct mwifiex_ds_encrypt_key *encrypt_key) { - int status = 0; + int status; if (encrypt_key->is_wapi_key) status = mwifiex_sec_ioctl_set_wapi_key(priv, encrypt_key); @@ -1252,11 +1250,9 @@ mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version, int mwifiex_get_signal_info(struct mwifiex_private *priv, struct mwifiex_ds_get_signal *signal) { - struct mwifiex_ds_get_signal info; - int status = 0; + int status; - memset(&info, 0, sizeof(struct mwifiex_ds_get_signal)); - info.selector = ALL_RSSI_INFO_MASK; + signal->selector = ALL_RSSI_INFO_MASK; /* Signal info can be obtained only if connected */ if (!priv->media_connected) { @@ -1269,13 +1265,10 @@ int mwifiex_get_signal_info(struct mwifiex_private *priv, HostCmd_ACT_GEN_GET, 0, signal); if (!status) { - if (signal) - memcpy(signal, &info, - sizeof(struct mwifiex_ds_get_signal)); - if (info.selector & BCN_RSSI_AVG_MASK) - priv->w_stats.qual.level = info.bcn_rssi_avg; - if (info.selector & BCN_NF_AVG_MASK) - priv->w_stats.qual.noise = info.bcn_nf_avg; + if (signal->selector & BCN_RSSI_AVG_MASK) + priv->w_stats.qual.level = signal->bcn_rssi_avg; + if (signal->selector & BCN_NF_AVG_MASK) + priv->w_stats.qual.noise = signal->bcn_nf_avg; } return status; @@ -1334,20 +1327,15 @@ int mwifiex_get_stats_info(struct mwifiex_private *priv, struct mwifiex_ds_get_stats *log) { - int ret = 0; - struct mwifiex_ds_get_stats get_log; + int ret; - memset(&get_log, 0, sizeof(struct mwifiex_ds_get_stats)); ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_GET_LOG, - HostCmd_ACT_GEN_GET, 0, &get_log); + HostCmd_ACT_GEN_GET, 0, log); if (!ret) { - if (log) - memcpy(log, &get_log, sizeof(struct - mwifiex_ds_get_stats)); - priv->w_stats.discard.fragment = get_log.fcs_error; - priv->w_stats.discard.retries = get_log.retry; - priv->w_stats.discard.misc = get_log.ack_failure; + priv->w_stats.discard.fragment = log->fcs_error; + priv->w_stats.discard.retries = log->retry; + priv->w_stats.discard.misc = log->ack_failure; } return ret; @@ -1425,7 +1413,7 @@ int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type, u32 reg_offset, u32 *value) { - int ret = 0; + int ret; struct mwifiex_ds_reg_rw reg_rw; reg_rw.type = cpu_to_le32(reg_type); @@ -1451,7 +1439,7 @@ int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes, u8 *value) { - int ret = 0; + int ret; struct mwifiex_ds_read_eeprom rd_eeprom; rd_eeprom.offset = cpu_to_le16((u16) offset); diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c index 8282679e64f..1fdddece747 100644 --- a/drivers/net/wireless/mwifiex/sta_rx.c +++ b/drivers/net/wireless/mwifiex/sta_rx.c @@ -41,7 +41,7 @@ int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb) { - int ret = 0; + int ret; struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); struct mwifiex_private *priv = adapter->priv[rx_info->bss_index]; struct rx_packet_hdr *rx_pkt_hdr; @@ -123,7 +123,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); struct rx_packet_hdr *rx_pkt_hdr; u8 ta[ETH_ALEN]; - u16 rx_pkt_type = 0; + u16 rx_pkt_type; struct mwifiex_private *priv = adapter->priv[rx_info->bss_index]; local_rx_pd = (struct rxpd *) (skb->data); @@ -141,10 +141,28 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, dev_kfree_skb_any(skb); return ret; } + if (local_rx_pd->rx_pkt_type == PKT_TYPE_AMSDU) { - mwifiex_11n_deaggregate_pkt(priv, skb); - return ret; + struct sk_buff_head list; + struct sk_buff *rx_skb; + + __skb_queue_head_init(&list); + + skb_pull(skb, local_rx_pd->rx_pkt_offset); + skb_trim(skb, local_rx_pd->rx_pkt_length); + + ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr, + priv->wdev->iftype, 0, false); + + while (!skb_queue_empty(&list)) { + rx_skb = __skb_dequeue(&list); + ret = mwifiex_recv_packet(adapter, rx_skb); + if (ret == -1) + dev_err(adapter->dev, "Rx of A-MSDU failed"); + } + return 0; } + /* * If the packet is not an unicast packet then send the packet * directly to os. Don't pass thru rx reordering diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c index 5d37ef16012..fa6221bc910 100644 --- a/drivers/net/wireless/mwifiex/sta_tx.c +++ b/drivers/net/wireless/mwifiex/sta_tx.c @@ -113,8 +113,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) /* sizeof(struct txpd) + Interface specific header */ #define NULL_PACKET_HDR 64 u32 data_len = NULL_PACKET_HDR; - struct sk_buff *skb = NULL; - int ret = 0; + struct sk_buff *skb; + int ret; struct mwifiex_txinfo *tx_info = NULL; if (adapter->surprise_removed) diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index ce772e078db..210120889df 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c @@ -68,7 +68,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, { int ret = -1; struct mwifiex_adapter *adapter = priv->adapter; - u8 *head_ptr = NULL; + u8 *head_ptr; struct txpd *local_tx_pd = NULL; head_ptr = (u8 *) mwifiex_process_sta_txpd(priv, skb); @@ -121,8 +121,8 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, struct sk_buff *skb, int status) { - struct mwifiex_private *priv = NULL, *tpriv = NULL; - struct mwifiex_txinfo *tx_info = NULL; + struct mwifiex_private *priv, *tpriv; + struct mwifiex_txinfo *tx_info; int i; if (!skb) @@ -169,9 +169,9 @@ int mwifiex_recv_packet_complete(struct mwifiex_adapter *adapter, struct sk_buff *skb, int status) { struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); - struct mwifiex_rxinfo *rx_info_parent = NULL; + struct mwifiex_rxinfo *rx_info_parent; struct mwifiex_private *priv; - struct sk_buff *skb_parent = NULL; + struct sk_buff *skb_parent; unsigned long flags; priv = adapter->priv[rx_info->bss_index]; diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c index 7ab4fb279f8..d41291529bc 100644 --- a/drivers/net/wireless/mwifiex/util.c +++ b/drivers/net/wireless/mwifiex/util.c @@ -152,8 +152,8 @@ int mwifiex_get_debug_info(struct mwifiex_private *priv, */ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb) { - struct mwifiex_rxinfo *rx_info = NULL; - struct mwifiex_private *priv = NULL; + struct mwifiex_rxinfo *rx_info; + struct mwifiex_private *priv; if (!skb) return -1; @@ -177,31 +177,6 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb) } /* - * Receive packet completion callback handler. - * - * This function updates the statistics and frees the buffer SKB. - */ -int mwifiex_recv_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb, int status) -{ - struct mwifiex_private *priv = NULL; - struct mwifiex_rxinfo *rx_info = NULL; - - if (!skb) - return 0; - - rx_info = MWIFIEX_SKB_RXCB(skb); - priv = mwifiex_bss_index_to_priv(adapter, rx_info->bss_index); - - if (priv && (status == -1)) - priv->stats.rx_dropped++; - - dev_kfree_skb_any(skb); - - return 0; -} - -/* * IOCTL completion callback handler. * * This function is called when a pending IOCTL is completed. diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index c009370f309..faa09e32902 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c @@ -799,7 +799,7 @@ u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv, const struct sk_buff *skb) { - u8 ret_val = 0; + u8 ret_val; struct timeval out_tstamp, in_tstamp; u32 queue_delay; |