From: Miri Korenblit Date: Sat, 21 Mar 2026 17:29:13 +0000 (+0200) Subject: wifi: iwlwifi: mld: use the dedicated helper to extract a link X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab97a6c94c8919373a7a8109a5a27475bd1102bd;p=thirdparty%2Fkernel%2Flinux.git wifi: iwlwifi: mld: use the dedicated helper to extract a link There is a helper, iwl_mld_fw_id_to_link_conf, that converts a fw link id into the bss_conf structure. Use it in two more places instead of retrieving the bss_conf directly from the fw-id-to-bss_conf mapping array. This required changing the loop bound in iwl_mld_process_per_link_stats() to ucode_capa.num_links, to avoid hitting a IWL_FW_CHECK for link ids > ucode_capa.num_links and < ARRAY_SIZE(fw_id_to_bss_conf), but this change makes sense anyway (there is no reason to iterate links that cannot be valid). Reviewed-by: Emmanuel Grumbach Signed-off-by: Miri Korenblit Link: https://patch.msgid.link/20260321192637.f8da2cd2a873.I7fbd3b4a86a5695206bb5083fdac49de9acc9dca@changeid --- diff --git a/drivers/net/wireless/intel/iwlwifi/mld/scan.c b/drivers/net/wireless/intel/iwlwifi/mld/scan.c index 17e0b13b5ce8f..7ed107fb0e8d4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/scan.c @@ -2055,9 +2055,7 @@ void iwl_mld_handle_scan_complete_notif(struct iwl_mld *mld, struct ieee80211_bss_conf *link_conf = NULL; if (fw_link_id != IWL_MLD_INVALID_FW_ID) - link_conf = - wiphy_dereference(mld->wiphy, - mld->fw_id_to_bss_conf[fw_link_id]); + link_conf = iwl_mld_fw_id_to_link_conf(mld, fw_link_id); /* It is possible that by the time the scan is complete the * link was already removed and is not valid. diff --git a/drivers/net/wireless/intel/iwlwifi/mld/stats.c b/drivers/net/wireless/intel/iwlwifi/mld/stats.c index 9b3149b9d2c22..54eb0ead78eee 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/stats.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/stats.c @@ -431,14 +431,13 @@ iwl_mld_process_per_link_stats(struct iwl_mld *mld, u32 total_airtime_usec = 0; for (u32 fw_id = 0; - fw_id < ARRAY_SIZE(mld->fw_id_to_bss_conf); + fw_id < mld->fw->ucode_capa.num_links; fw_id++) { const struct iwl_stats_ntfy_per_link *link_stats; struct ieee80211_bss_conf *bss_conf; int sig; - bss_conf = wiphy_dereference(mld->wiphy, - mld->fw_id_to_bss_conf[fw_id]); + bss_conf = iwl_mld_fw_id_to_link_conf(mld, fw_id); if (!bss_conf || bss_conf->vif->type != NL80211_IFTYPE_STATION) continue;