]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mt76: mt7915: fix some sparse warnings
authorRyder Lee <ryder.lee@mediatek.com>
Sat, 16 May 2020 09:05:18 +0000 (17:05 +0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 28 May 2020 15:55:30 +0000 (17:55 +0200)
This fixes the following sparse warning:

drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse: sparse: mixing different enum types:
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse:    unsigned int enum mt7915_txq_id
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse:    unsigned int enum mt76_txq_id
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse:    expected unsigned char const [usertype] *ies
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse:    got unsigned char const [noderef] <asn:4> *
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse: sparse: incorrect type in argument 1 (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse:    expected unsigned int w
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse:    got restricted __le32 [usertype] supp_ht_mcs
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse: sparse: restricted __le32 degrades to integer
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1429:60: sparse: sparse: bad assignment (>>=) to restricted __le16
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1773:16: sparse: sparse: restricted __le32 degrades to integer

Fixes: 8803c0af1a6e ("mt76: mt7915: add HE bss_conf support for interfaces")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c

index 2edff868b7c9830868badafed58ce11f937886f7..695364d35eb2e75f4290bae1b3909fe0cea21eca 100644 (file)
@@ -220,7 +220,7 @@ static int __mt7915_mcu_msg_send(struct mt7915_dev *dev, struct sk_buff *skb,
 {
        struct mt7915_mcu_txd *mcu_txd;
        u8 seq, pkt_fmt, qidx;
-       enum mt7915_txq_id txq;
+       enum mt76_txq_id txq;
        __le32 *txd;
        u32 val;
 
@@ -815,8 +815,7 @@ static void mt7915_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy,
        struct mt7915_he_obss_narrow_bw_ru_data *data = _data;
        const struct element *elem;
 
-       elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, bss->ies->data,
-                                 bss->ies->len);
+       elem = ieee80211_bss_get_elem(bss, WLAN_EID_EXT_CAPABILITY);
 
        if (!elem || elem->datalen < 10 ||
            !(elem->data[10] &
@@ -1954,7 +1953,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
 
                ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs;
                ra->supp_mode |= MODE_HT;
-               mcs = hweight32(ra->supp_ht_mcs) - 1;
+               mcs = hweight32(le32_to_cpu(ra->supp_ht_mcs)) - 1;
                ra->af = sta->ht_cap.ampdu_factor;
                ra->ht_gf = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
 
@@ -1972,7 +1971,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
        }
 
        if (sta->vht_cap.vht_supported) {
-               __le16 mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
+               u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
                u16 vht_mcs;
                u8 af, mcs_prev;
 
@@ -2399,7 +2398,7 @@ static int mt7915_mcu_init_download(struct mt7915_dev *dev, u32 addr,
        };
        int attr;
 
-       if (req.addr == MCU_PATCH_ADDRESS)
+       if (req.addr == cpu_to_le32(MCU_PATCH_ADDRESS))
                attr = -MCU_CMD_PATCH_START_REQ;
        else
                attr = -MCU_CMD_TARGET_ADDRESS_LEN_REQ;