[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <39236708-f668-e99e-e749-6b7b863241a8@gmail.com>
Date: Tue, 16 Nov 2021 09:54:52 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Guo Zhengkui <guozhengkui@...o.com>,
Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michael Straube <straube.linux@...il.com>,
"open list:STAGING SUBSYSTEM" <linux-staging@...ts.linux.dev>,
open list <linux-kernel@...r.kernel.org>
Cc: kernel@...o.com
Subject: Re: [PATCH] staging: r8188eu: fix array_size.cocci warning
On 11/16/21 09:41, Guo Zhengkui wrote:
> diff --git a/drivers/staging/r8188eu/core/rtw_rf.c b/drivers/staging/r8188eu/core/rtw_rf.c
> index 2ec56012516e..e704092d31d0 100644
> --- a/drivers/staging/r8188eu/core/rtw_rf.c
> +++ b/drivers/staging/r8188eu/core/rtw_rf.c
> @@ -35,7 +35,7 @@ static struct ch_freq ch_freq_map[] = {
> {216, 5080},/* Japan, means J16 */
> };
>
> -static int ch_freq_map_num = (sizeof(ch_freq_map) / sizeof(struct ch_freq));
> +static int ch_freq_map_num = ARRAY_SIZE(ch_freq_map);
>
> u32 rtw_ch2freq(u32 channel)
> {
>
Hm, do we need this variable to be static? It's used only in 2
expressions in rtw_ch2freq() (and 2nd one can be removed by
per-initializing freq with 2412).
I think, it can be places on stack to reduce binary size.
With regards,
Pavel Skripkin
Powered by blists - more mailing lists