mt76: mt7915: fix endiannes warning mt7915_mcu_beacon_check_caps
authorLorenzo Bianconi <lorenzo@kernel.org>
Wed, 20 Oct 2021 23:09:32 +0000 (01:09 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 23 Oct 2021 11:23:44 +0000 (13:23 +0200)
Fix the following sparse warning mt7915_mcu_beacon_check_caps routine:
warning: cast to restricted __le32
warning: cast from restricted __le16

Fixes: 22dffbddf0167 ("mt76: mt7915: introduce mt7915_mcu_beacon_check_caps()")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c

index 6c93ca24307fcc3f1f347a4b04845d0fbda44cf6..79990a420fc6a2eeb37fcad4c214604fc7c72160 100644 (file)
@@ -2561,9 +2561,8 @@ mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif,
                              len);
        if (ie && ie[1] >= sizeof(*ht)) {
                ht = (void *)(ie + 2);
-               bc = le32_to_cpu(ht->cap_info);
-
-               vc->ldpc |= !!(bc & IEEE80211_HT_CAP_LDPC_CODING);
+               vc->ldpc |= !!(le16_to_cpu(ht->cap_info) &
+                              IEEE80211_HT_CAP_LDPC_CODING);
        }
 
        ie = cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, mgmt->u.beacon.variable,