diff mbox series

[1/8] wifi: rtw89: refine clearing supported bands to check 2/5 GHz first

Message ID 20230602150556.36777-2-pkshih@realtek.com (mailing list archive)
State Accepted
Commit b7d170d5a670de8d30d2db94179099f52f8df485
Delegated to: Kalle Valo
Headers show
Series wifi: rtw89: support 6 GHz power types STD/LPI/VLP | expand

Commit Message

Ping-Ke Shih June 2, 2023, 3:05 p.m. UTC
From: Zong-Zhe Yang <kevin_yang@realtek.com>

We refine to check if supported bands of NL80211_BAND_2GHZ and
NL80211_BAND_5GHZ exist before freeing their iftype_data. For
now, it does not really encounter problems because all current
chips support both 2 GHz and 5 GHz. But, driver actually allows
chips to declare whether 2/5 GHz are supported or not. In case
some future chips really don't support them, we refine this code.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Kalle Valo June 8, 2023, 3:59 p.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Zong-Zhe Yang <kevin_yang@realtek.com>
> 
> We refine to check if supported bands of NL80211_BAND_2GHZ and
> NL80211_BAND_5GHZ exist before freeing their iftype_data. For
> now, it does not really encounter problems because all current
> chips support both 2 GHz and 5 GHz. But, driver actually allows
> chips to declare whether 2/5 GHz are supported or not. In case
> some future chips really don't support them, we refine this code.
> 
> Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

8 patches applied to wireless-next.git, thanks.

b7d170d5a670 wifi: rtw89: refine clearing supported bands to check 2/5 GHz first
ffc235115313 wifi: rtw89: regd: judge 6 GHz according to chip and BIOS
9468046ff54e wifi: rtw89: regd: update regulatory map to R64-R40
f6baa1d3d570 wifi: rtw89: process regulatory for 6 GHz power type
b742394cfe80 wifi: rtw89: 8852c: update TX power tables to R63 with 6 GHz power type (1 of 3)
2a8ec45f4d0e wifi: rtw89: 8852c: update TX power tables to R63 with 6 GHz power type (2 of 3)
dad142c3f56a wifi: rtw89: 8852c: update TX power tables to R63 with 6 GHz power type (3 of 3)
5883fc2ef857 wifi: rtw89: 8852c: update RF radio A/B parameters to R63
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 101047686fffb..1f841dcba0f03 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -3390,8 +3390,10 @@  static void rtw89_core_clr_supported_band(struct rtw89_dev *rtwdev)
 {
 	struct ieee80211_hw *hw = rtwdev->hw;
 
-	kfree(hw->wiphy->bands[NL80211_BAND_2GHZ]->iftype_data);
-	kfree(hw->wiphy->bands[NL80211_BAND_5GHZ]->iftype_data);
+	if (hw->wiphy->bands[NL80211_BAND_2GHZ])
+		kfree(hw->wiphy->bands[NL80211_BAND_2GHZ]->iftype_data);
+	if (hw->wiphy->bands[NL80211_BAND_5GHZ])
+		kfree(hw->wiphy->bands[NL80211_BAND_5GHZ]->iftype_data);
 	if (hw->wiphy->bands[NL80211_BAND_6GHZ])
 		kfree(hw->wiphy->bands[NL80211_BAND_6GHZ]->iftype_data);
 	kfree(hw->wiphy->bands[NL80211_BAND_2GHZ]);