Skip to content

Commit e43b87f

Browse files
committed
wifi: mt76: fix mt76_get_rate
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>
1 parent 6ea13e6 commit e43b87f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/wireless/mediatek/mt76/mac80211.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,14 +1697,15 @@ int mt76_get_rate(struct mt76_dev *dev,
16971697
struct ieee80211_supported_band *sband,
16981698
int idx, bool cck)
16991699
{
1700+
bool is_2g = sband->band == NL80211_BAND_2GHZ;
17001701
int i, offset = 0, len = sband->n_bitrates;
17011702

17021703
if (cck) {
1703-
if (sband != &dev->phy.sband_2g.sband)
1704+
if (!is_2g)
17041705
return 0;
17051706

17061707
idx &= ~BIT(2); /* short preamble */
1707-
} else if (sband == &dev->phy.sband_2g.sband) {
1708+
} else if (is_2g) {
17081709
offset = 4;
17091710
}
17101711

0 commit comments

Comments
 (0)