mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] staging: rtl8192e: rtl819x_HTProc: make arrays const and one static
@ 2022-11-03 13:06 Colin Ian King
  2022-11-03 22:02 ` Philipp Hortmann
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-11-03 13:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Philipp Hortmann, Aaron Lawrence,
	Yogesh Hegde, linux-staging
  Cc: kernel-janitors, linux-kernel

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

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/staging/rtl8192e/rtl819x_HTProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
index 62aa8e893c34..84ec8df047d7 100644
--- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
@@ -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__);
-- 
2.38.1


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

* Re: [PATCH][next] staging: rtl8192e: rtl819x_HTProc: make arrays const and one static
  2022-11-03 13:06 [PATCH][next] staging: rtl8192e: rtl819x_HTProc: make arrays const and one static Colin Ian King
@ 2022-11-03 22:02 ` Philipp Hortmann
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Hortmann @ 2022-11-03 22:02 UTC (permalink / raw)
  To: Colin Ian King, Greg Kroah-Hartman, Aaron Lawrence, Yogesh Hegde,
	linux-staging
  Cc: kernel-janitors, linux-kernel

On 11/3/22 14:06, Colin Ian King wrote:
> Make two dead-only arrays const. Make array EWC11NHTCap static const
> so it is not populated on the stack, makes the code smaller too.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>   drivers/staging/rtl8192e/rtl819x_HTProc.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
> index 62aa8e893c34..84ec8df047d7 100644
> --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
> +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
> @@ -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__);

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

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

end of thread, other threads:[~2022-11-03 22:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 13:06 [PATCH][next] staging: rtl8192e: rtl819x_HTProc: make arrays const and one static Colin Ian King
2022-11-03 22:02 ` Philipp Hortmann

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

all inboxes | Powered by JetHome®