On 1/17/2025 4:44 PM, Sidhanta Sahu wrote:
On 1/17/2025 4:36 PM, Aloka Dixit wrote:
On 1/15/2025 11:36 AM, Sidhanta Sahu wrote:
+static struct ath11k_vif *ath11k_mac_get_tx_arvif(struct
ath11k_vif *arvif)
+{
+ if (arvif->vif->mbssid_tx_vif)
+ return ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
+
+ return NULL;
+}
+
static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
{
struct ath11k_vif *tx_arvif;
@@ -1538,7 +1546,7 @@ static int
ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
u32 params = 0;
u8 i = 0;
- tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
+ tx_arvif = ath11k_mac_get_tx_arvif(arvif);
ath11k_mac_get_tx_arvif can return NULL, below, we are accessing
tx_arvif without a NULL check. Shouldn't we add a null check
wherever applicable to prevent potential issues?
beacons =
ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
tx_arvif->vif, 0);
ath11k_mac_setup_bcn_tmpl_ema() gets called only when tx_arvif is
non-NULL.
If tx_arvif is not NULL (and known already), Is it still required to
call `ath11k_mac_get_tx_arvif` under `ath11k_mac_setup_bcn_tmpl_ema`?
Yes, as per the current code it still needs to retrieve tx_arvif to be used.
This patch 1/5 only creates a new function to refactor existing repeated
code.
The next patch,
https://patchwork.kernel.org/project/linux-wireless/patch/20250114223612.2979310-3-quic_alokad@xxxxxxxxxxx/,
adds few more changes on the same code.