diff mbox series

[04/16] wifi: mt76: fix mt76_get_rate

Message ID 20240816173529.17873-4-nbd@nbd.name
State Superseded
Headers show
Series [01/16] mt76: mt7603: fix mixed declarations and code | expand

Commit Message

Felix Fietkau Aug. 16, 2024, 5:35 p.m. UTC
Do not assume that the first phy has 2 GHz support.
Check sband->band instead of accessing dev->phy.sband_2g.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mac80211.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index d96ee759828e..8733906fcb21 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -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;
 	}