Commit e43b87f6 authored by Felix Fietkau's avatar Felix Fietkau
Browse files

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: default avatarFelix Fietkau <nbd@nbd.name>
parent 6ea13e6b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;
	}