> -----Original Message----- > From: Martin Kaistra <martin.kaistra@xxxxxxxxxxxxx> > Sent: Monday, December 18, 2023 10:37 PM > To: linux-wireless@xxxxxxxxxxxxxxx > Cc: Jes Sorensen <Jes.Sorensen@xxxxxxxxx>; Kalle Valo <kvalo@xxxxxxxxxx>; Ping-Ke Shih > <pkshih@xxxxxxxxxxx>; Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx>; Sebastian Andrzej Siewior > <bigeasy@xxxxxxxxxxxxx> > Subject: [PATCH 16/20] wifi: rtl8xxxu: support multiple interfaces in get_macid() > > As sta_info->macid does not get set in station mode, we can simplify > this function by directly returning 0 if sta itself or sta_info is not > set. > > Signed-off-by: Martin Kaistra <martin.kaistra@xxxxxxxxxxxxx> > --- > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > index 3851fc90339e0..ad76cddef81b2 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > @@ -4053,10 +4053,13 @@ static inline u8 rtl8xxxu_get_macid(struct rtl8xxxu_priv *priv, > { > struct rtl8xxxu_sta_info *sta_info; > > - if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION || !sta) > + if (!sta) > return 0; > > sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; > + if (!sta_info) > + return 0; > + > return sta_info->macid; I checked where driver assign macid, and only if (vif->type == NL80211_IFTYPE_AP) { sta_info->macid = rtl8xxxu_acquire_macid(priv); That means STA mode can be macid == 0 always, right? This will be a problem. At least TX rate will be incorrect. Ping-Ke