Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtlwifi / rtl8723ae / trx.c
index a313be8c21d28d5708fdbc34e49f0db3fa7836a2..6c64365308d3780f1bd84e1f6c4dcb5177fb9be1 100644 (file)
@@ -244,10 +244,9 @@ static void _rtl8723ae_translate_rx_signal_stuff(struct ieee80211_hw *hw,
        struct ieee80211_hdr *hdr;
        u8 *tmp_buf;
        u8 *praddr;
-       u8 *psaddr;
        __le16 fc;
        u16 type;
-       bool packet_matchbssid, packet_toself, packet_beacon;
+       bool packet_matchbssid, packet_toself, packet_beacon = false;
 
        tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift;
 
@@ -255,7 +254,6 @@ static void _rtl8723ae_translate_rx_signal_stuff(struct ieee80211_hw *hw,
        fc = hdr->frame_control;
        type = WLAN_FC_GET_TYPE(fc);
        praddr = hdr->addr1;
-       psaddr = ieee80211_get_SA(hdr);
 
        packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) &&
                            (!compare_ether_addr(mac->bssid,
@@ -309,9 +307,6 @@ bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw,
        rx_status->freq = hw->conf.channel->center_freq;
        rx_status->band = hw->conf.channel->band;
 
-       hdr = (struct ieee80211_hdr *)(skb->data + status->rx_drvinfo_size
-               + status->rx_bufshift);
-
        if (status->crc)
                rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
 
@@ -332,6 +327,13 @@ bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw,
         * to decrypt it
         */
        if (status->decrypted) {
+               hdr = (struct ieee80211_hdr *)(skb->data +
+                      status->rx_drvinfo_size + status->rx_bufshift);
+
+               if (!hdr) {
+                       /* during testing, hdr could be NULL here */
+                       return false;
+               }
                if ((ieee80211_is_robust_mgmt_frame(hdr)) &&
                        (ieee80211_has_protected(hdr->frame_control)))
                        rx_status->flag &= ~RX_FLAG_DECRYPTED;
@@ -397,8 +399,7 @@ void rtl8723ae_tx_fill_desc(struct ieee80211_hw *hw,
        } else if (mac->opmode == NL80211_IFTYPE_AP ||
                mac->opmode == NL80211_IFTYPE_ADHOC) {
                if (sta)
-                       bw_40 = sta->ht_cap.cap &
-                               IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+                       bw_40 = sta->bandwidth >= IEEE80211_STA_RX_BW_40;
        }
 
        seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;