diff options
author | Johannes Berg <johannes.berg@intel.com> | 2023-08-28 09:54:39 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2023-09-11 11:27:23 +0200 |
commit | e8c1841278a78362f7034f3de415096ddb19f097 (patch) | |
tree | 2c5068e9417c0a71d8cf3ca199bd667657af2498 /net/mac80211/main.c | |
parent | wifi: mac80211: fix BA session teardown race (diff) | |
download | linux-e8c1841278a78362f7034f3de415096ddb19f097.tar.xz linux-e8c1841278a78362f7034f3de415096ddb19f097.zip |
wifi: cfg80211: annotate iftype_data pointer with sparse
There were are a number of cases in mac80211 and iwlwifi (at
least) that used the sband->iftype_data pointer directly,
instead of using the accessors to find the right array entry
to use.
Make sparse warn when such a thing is done.
To not have a lot of casts, add two helper functions/macros
- ieee80211_set_sband_iftype_data()
- for_each_sband_iftype_data()
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r-- | net/mac80211/main.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index eabf6c1bf3ff..bf8f72c412ee 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1066,6 +1066,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) supp_he = false; supp_eht = false; for (band = 0; band < NUM_NL80211_BANDS; band++) { + const struct ieee80211_sband_iftype_data *iftd; struct ieee80211_supported_band *sband; sband = local->hw.wiphy->bands[band]; @@ -1112,11 +1113,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) supp_ht = supp_ht || sband->ht_cap.ht_supported; supp_vht = supp_vht || sband->vht_cap.vht_supported; - for (i = 0; i < sband->n_iftype_data; i++) { - const struct ieee80211_sband_iftype_data *iftd; - - iftd = &sband->iftype_data[i]; - + for_each_sband_iftype_data(sband, i, iftd) { supp_he = supp_he || iftd->he_cap.has_he; supp_eht = supp_eht || iftd->eht_cap.has_eht; } |