linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] wifi: rtlwifi: make read-only arrays static const
@ 2024-09-12 13:53 Colin Ian King
  2024-09-13  1:20 ` Ping-Ke Shih
  2024-09-20  2:45 ` Ping-Ke Shih
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2024-09-12 13:53 UTC (permalink / raw)
  To: Ping-Ke Shih, Kalle Valo, Dmitry Antipov, linux-wireless
  Cc: kernel-janitors, linux-kernel

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(-)

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
 	};
 
-- 
2.39.2


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

* RE: [PATCH][next] wifi: rtlwifi: make read-only arrays static const
  2024-09-12 13:53 [PATCH][next] wifi: rtlwifi: make read-only arrays static const Colin Ian King
@ 2024-09-13  1:20 ` Ping-Ke Shih
  2024-09-20  2:45 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-09-13  1:20 UTC (permalink / raw)
  To: Colin Ian King, Kalle Valo, Dmitry Antipov,
	linux-wireless@vger.kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

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>



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

* Re: [PATCH][next] wifi: rtlwifi: make read-only arrays static const
  2024-09-12 13:53 [PATCH][next] wifi: rtlwifi: make read-only arrays static const Colin Ian King
  2024-09-13  1:20 ` Ping-Ke Shih
@ 2024-09-20  2:45 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-09-20  2:45 UTC (permalink / raw)
  To: Colin Ian King, Ping-Ke Shih, Kalle Valo, Dmitry Antipov,
	linux-wireless
  Cc: kernel-janitors, linux-kernel

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


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

end of thread, other threads:[~2024-09-20  2:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-12 13:53 [PATCH][next] wifi: rtlwifi: make read-only arrays static const Colin Ian King
2024-09-13  1:20 ` Ping-Ke Shih
2024-09-20  2:45 ` 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;
as well as URLs for NNTP newsgroup(s).