]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: fix mt76_get_rate
authorFelix Fietkau <nbd@nbd.name>
Tue, 27 Aug 2024 09:29:51 +0000 (11:29 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 6 Sep 2024 09:14:37 +0000 (11:14 +0200)
Do not assume that the first phy has 2 GHz support.
Check sband->band instead of accessing dev->phy.sband_2g.

Link: https://patch.msgid.link/20240827093011.18621-4-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mac80211.c

index d96ee759828ed226351cbefe7aa8c4d85805f8ff..8733906fcb21363dd5cc03a5631c9af580a4c196 100644 (file)
@@ -1697,14 +1697,15 @@ int mt76_get_rate(struct mt76_dev *dev,
                  struct ieee80211_supported_band *sband,
                  int idx, bool cck)
 {
+       bool is_2g = sband->band == NL80211_BAND_2GHZ;
        int i, offset = 0, len = sband->n_bitrates;
 
        if (cck) {
-               if (sband != &dev->phy.sband_2g.sband)
+               if (!is_2g)
                        return 0;
 
                idx &= ~BIT(2); /* short preamble */
-       } else if (sband == &dev->phy.sband_2g.sband) {
+       } else if (is_2g) {
                offset = 4;
        }