Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH rtw-next] wifi: rtw89: regd: avoid freeing devm-allocated 6 GHz band
@ 2026-11-29  8:44 Josef Schlehofer
  2026-11-30  4:03 ` Ping-Ke Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Schlehofer @ 2026-11-29  8:44 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: linux-wireless

When ACPI disallows 6 GHz, rtw89_regd_setup_6ghz() frees the band and
its iftype data with kfree(), even though both are devm-allocated.
Devres then frees them again during device teardown.

Only clear the wiphy band pointer and leave the allocations to devres.

Fixes: 145df52a8671 ("wifi: rtw89: Convert rtw89_core_set_supported_band to use devm_*")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
Compile-tested only. The path needs ACPI that disallows 6 GHz, and rtw89
skips that ACPI check on USB, so my RTL8922AU cannot reach it.

 drivers/net/wireless/realtek/rtw89/regd.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/regd.c b/drivers/net/wireless/realtek/rtw89/regd.c
index 017e6a2b4b0..e8a383c6680 100644
--- a/drivers/net/wireless/realtek/rtw89/regd.c
+++ b/drivers/net/wireless/realtek/rtw89/regd.c
@@ -590,7 +590,6 @@ static void rtw89_regd_setup_6ghz(struct rtw89_dev *rtwdev, struct wiphy *wiphy)
 	bool chip_support_6ghz = test_bit(NL80211_BAND_6GHZ, rtwdev->supported_bands);
 	bool skip_acpi_dsm = rtwdev->hci.type == RTW89_HCI_TYPE_USB;
 	bool regd_allow_6ghz = chip_support_6ghz;
-	struct ieee80211_supported_band *sband;
 	struct rtw89_acpi_dsm_result res = {};
 	int ret;
 	u8 val;
@@ -635,13 +634,7 @@ static void rtw89_regd_setup_6ghz(struct rtw89_dev *rtwdev, struct wiphy *wiphy)
 		return;
 	}
 
-	sband = wiphy->bands[NL80211_BAND_6GHZ];
-	if (!sband)
-		return;
-
 	wiphy->bands[NL80211_BAND_6GHZ] = NULL;
-	kfree((__force void *)sband->iftype_data);
-	kfree(sband);
 }
 
 #define RTW89_DEF_REGD_STR(regd) \
-- 
2.54.0 (Apple Git-157)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-30  4:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29  8:44 [PATCH rtw-next] wifi: rtw89: regd: avoid freeing devm-allocated 6 GHz band Josef Schlehofer
2026-11-30  4:03 ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox