diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2023-09-14 17:57:53 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2023-10-09 23:14:52 +0000 |
commit | 2f528e6583b4c64b0d00df3744af298d6351c937 (patch) | |
tree | 3e35825d29bb6eab1c465211bbb707a977565f09 | |
parent | 61c5d5679ba8e9075f3486a08eb0bdfd507d1108 (diff) | |
download | src-2f528e6583b4c64b0d00df3744af298d6351c937.tar.gz src-2f528e6583b4c64b0d00df3744af298d6351c937.zip |
LinuxKPI: 802.11: fix counting the number of supbands
While the main purpose was to assign an(y) early chandef with the
loop, later additions made use of it to also count supbands as well
as to initialise max_rates.
Due to the main goal we can exit the loop early and not properly
count and initialise supbands and max_rates.
Move the terminating condition into the loop and make it a continue
rather than ending the loop.
Fixes: d9945d7821b9b ("improve hw_scan")
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
(cherry picked from commit f454a4a10dc027474a85269cb4a3f50bbbf90528)
(cherry picked from commit 96655d8a7db48f0944aebf07ffdcaa8a23aaa35a)
-rw-r--r-- | sys/compat/linuxkpi/common/src/linux_80211.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index f5951c95a8df..5e7a3ff91b9f 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3767,8 +3767,7 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) * in any band so we can scale [(ext) sup rates] IE(s) accordingly. */ lhw->supbands = lhw->max_rates = 0; - for (band = 0; band < NUM_NL80211_BANDS && - hw->conf.chandef.chan == NULL; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { struct ieee80211_supported_band *supband; struct linuxkpi_ieee80211_channel *channels; @@ -3779,6 +3778,10 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) lhw->supbands++; lhw->max_rates = max(lhw->max_rates, supband->n_bitrates); + /* If we have a channel, we need to keep counting supbands. */ + if (hw->conf.chandef.chan != NULL) + continue; + channels = supband->channels; for (i = 0; i < supband->n_channels; i++) { |