From 8fa56156a85eee5994896748817f593574c48e81 Mon Sep 17 00:00:00 2001 From: Carlos Garces Date: Thu, 11 Mar 2021 23:39:00 +0100 Subject: [PATCH] Fix wireless regulatory API misuse Port of https://github.com/torvalds/linux/commit/81f153faacd04c049e5482d6ff33daddc30ed44e --- include/rtw_wifi_regd.h | 2 +- os_dep/linux/ioctl_cfg80211.c | 4 ++-- os_dep/linux/wifi_regd.c | 17 +---------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/include/rtw_wifi_regd.h b/include/rtw_wifi_regd.h index 8e42fce..e3d1ac0 100644 --- a/include/rtw_wifi_regd.h +++ b/include/rtw_wifi_regd.h @@ -29,6 +29,6 @@ enum country_code_type_t { }; void rtw_regd_apply_flags(struct wiphy *wiphy); -int rtw_regd_init(struct wiphy *wiphy); +void rtw_regd_init(struct wiphy *wiphy); #endif /* __RTW_WIFI_REGD_H__ */ diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index fb59427..70f6434 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -10000,6 +10000,8 @@ struct wiphy *rtw_wiphy_alloc(_adapter *padapter, struct device *dev) #endif rtw_cfg80211_preinit_wiphy(padapter, wiphy); + /* init regulary domain */ + rtw_regd_init(wiphy); RTW_INFO(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy)); @@ -10034,8 +10036,6 @@ int rtw_wiphy_register(struct wiphy *wiphy) rtw_cfgvendor_attach(wiphy); #endif - rtw_regd_init(wiphy); - return wiphy_register(wiphy); } diff --git a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c index 4c10f84..8159c18 100644 --- a/os_dep/linux/wifi_regd.c +++ b/os_dep/linux/wifi_regd.c @@ -400,25 +400,10 @@ static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode) return NULL; } -int rtw_regd_init(struct wiphy *wiphy) +void rtw_regd_init(struct wiphy *wiphy) { -#if 0 - if (rtw_regd == NULL) { - rtw_regd = (struct rtw_regulatory *) - rtw_malloc(sizeof(struct rtw_regulatory)); - - rtw_regd->alpha2[0] = '9'; - rtw_regd->alpha2[1] = '9'; - - rtw_regd->country_code = COUNTRY_CODE_USER; - } - - RTW_INFO("%s: Country alpha2 being used: %c%c\n", - __func__, rtw_regd->alpha2[0], rtw_regd->alpha2[1]); -#endif _rtw_regd_init_wiphy(NULL, wiphy); - return 0; } #endif /* CONFIG_IOCTL_CFG80211 */