diff mbox series

[next] wifi: rtlwifi: make read-only arrays static const

Message ID 20240912135335.590464-1-colin.i.king@gmail.com (mailing list archive)
State Accepted
Delegated to: Ping-Ke Shih
Headers show
Series [next] wifi: rtlwifi: make read-only arrays static const | expand

Commit Message

Colin Ian King Sept. 12, 2024, 1:53 p.m. UTC
Don't populate the read-only arrays params, toshiba_smid1, toshiba_smid2,
samsung_smid and lenovo_smid on the stack at run time, instead make them
static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 .../wireless/realtek/rtlwifi/rtl8723be/hw.c    | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Ping-Ke Shih Sept. 13, 2024, 1:20 a.m. UTC | #1
Colin Ian King <colin.i.king@gmail.com> wrote:
> Don't populate the read-only arrays params, toshiba_smid1, toshiba_smid2,
> samsung_smid and lenovo_smid on the stack at run time, instead make them
> static const.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Ping-Ke Shih Sept. 20, 2024, 2:45 a.m. UTC | #2
Colin Ian King <colin.i.king@gmail.com> wrote:

> Don't populate the read-only arrays params, toshiba_smid1, toshiba_smid2,
> samsung_smid and lenovo_smid on the stack at run time, instead make them
> static const.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

9e698af3a42f wifi: rtlwifi: make read-only arrays static const

---
https://github.com/pkshih/rtw.git
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
index 0e77de1baaf8..bcfc53af4c1a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
@@ -2040,31 +2040,33 @@  static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-	int params[] = {RTL8723BE_EEPROM_ID, EEPROM_VID, EEPROM_DID,
-			EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
-			EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
-			COUNTRY_CODE_WORLD_WIDE_13};
+	static const int params[] = {
+		RTL8723BE_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+		EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+		EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+		COUNTRY_CODE_WORLD_WIDE_13
+	};
 	u8 *hwinfo;
 	int i;
 	bool is_toshiba_smid1 = false;
 	bool is_toshiba_smid2 = false;
 	bool is_samsung_smid = false;
 	bool is_lenovo_smid = false;
-	u16 toshiba_smid1[] = {
+	static const u16 toshiba_smid1[] = {
 		0x6151, 0x6152, 0x6154, 0x6155, 0x6177, 0x6178, 0x6179, 0x6180,
 		0x7151, 0x7152, 0x7154, 0x7155, 0x7177, 0x7178, 0x7179, 0x7180,
 		0x8151, 0x8152, 0x8154, 0x8155, 0x8181, 0x8182, 0x8184, 0x8185,
 		0x9151, 0x9152, 0x9154, 0x9155, 0x9181, 0x9182, 0x9184, 0x9185
 	};
-	u16 toshiba_smid2[] = {
+	static const u16 toshiba_smid2[] = {
 		0x6181, 0x6184, 0x6185, 0x7181, 0x7182, 0x7184, 0x7185, 0x8181,
 		0x8182, 0x8184, 0x8185, 0x9181, 0x9182, 0x9184, 0x9185
 	};
-	u16 samsung_smid[] = {
+	static const u16 samsung_smid[] = {
 		0x6191, 0x6192, 0x6193, 0x7191, 0x7192, 0x7193, 0x8191, 0x8192,
 		0x8193, 0x9191, 0x9192, 0x9193
 	};
-	u16 lenovo_smid[] = {
+	static const u16 lenovo_smid[] = {
 		0x8195, 0x9195, 0x7194, 0x8200, 0x8201, 0x8202, 0x9199, 0x9200
 	};