Skip to contentSkip to conversation

staging: rtl8192e: rtl819x_HTProc: make arrays const and one static

PATCH In review Colin Ian King 2 participants 2 messages Nov 3, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192e: rtl819x_HTProc: make arrays const and one static

Make two dead-only arrays const. Make array EWC11NHTCap static const so it is not populated on the stack, makes the code smaller too.

---
 drivers/staging/rtl8192e/rtl819x_HTProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +3 -3
index 62aa8e893c34..84ec8df047d7 100644
@@ -282,7 +282,7 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
 	memset(posHTCap, 0, *len);
 
 	if ((bAssoc) && (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)) {
-		u8	EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
+		static const u8	EWC11NHTCap[] = { 0x00, 0x90, 0x4c, 0x33 };
 
 		memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
 		pCapELE = (struct ht_capab_ele *)&posHTCap[4];
@@ -515,8 +515,8 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 	u16 nMaxAMSDUSize = 0;
 	u8 *pMcsFilter = NULL;
 
-	static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
-	static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
+	static const u8 EWC11NHTCap[] = { 0x00, 0x90, 0x4c, 0x33 };
+	static const u8 EWC11NHTInfo[] = { 0x00, 0x90, 0x4c, 0x34 };
 
 	if (!pHTInfo->bCurrentHTSupport) {
 		netdev_warn(ieee->dev, "%s(): HT_DISABLE\n", __func__);
Signature · 1 line
2.38.1
Tested-by on v1 1/1
#1 lore raw
Quoted 22 lines · Colin Ian King

Make two dead-only arrays const. Make array EWC11NHTCap static const so it is not populated on the stack, makes the code smaller too.

---
  drivers/staging/rtl8192e/rtl819x_HTProc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +1 -1
index 62aa8e893c34..84ec8df047d7 100644
@@ -282,7 +282,7 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
  	memset(posHTCap, 0, *len);
 
  	if ((bAssoc) && (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)) {
-		u8	EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
+		static const u8	EWC11NHTCap[] = { 0x00, 0x90, 0x4c, 0x33 };
 
  		memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
  		pCapELE = (struct ht_capab_ele *)&posHTCap[4];

drivers/staging/rtl8192e/rtl819x_HTProc.c void HTOnAssocRsp(struct rtllib_device *ieee) · line 522

Quoted 10 lines
drivers/staging/rtl8192e/rtl819x_HTProc.c +2 -2
@@ -515,8 +515,8 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
  	u16 nMaxAMSDUSize = 0;
  	u8 *pMcsFilter = NULL;
 
-	static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
-	static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
+	static const u8 EWC11NHTCap[] = { 0x00, 0x90, 0x4c, 0x33 };
+	static const u8 EWC11NHTInfo[] = { 0x00, 0x90, 0x4c, 0x34 };
 
  	if (!pHTInfo->bCurrentHTSupport) {
  		netdev_warn(ieee->dev, "%s(): HT_DISABLE\n", __func__);