[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210916124248.GI2088@kadam>
Date: Thu, 16 Sep 2021 15:42:48 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: CGEL <cgel.zte@...il.com>
Cc: Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michael Straube <straube.linux@...il.com>,
Martin Kaiser <martin@...ser.cx>,
Nathan Chancellor <nathan@...nel.org>,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Changcheng Deng <deng.changcheng@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH linux-next] staging: r8188eu: use ARRAY_SIZE
On Thu, Sep 16, 2021 at 01:59:36AM +0000, CGEL wrote:
> From: Changcheng Deng <deng.changcheng@....com.cn>
>
> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@....com.cn>
> ---
> drivers/staging/r8188eu/os_dep/usb_intf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
> index 78c857d..c7de8ee 100644
> --- a/drivers/staging/r8188eu/os_dep/usb_intf.c
> +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
> @@ -261,8 +261,7 @@ static void process_spec_devid(const struct usb_device_id *pdid)
> u16 vid, pid;
> u32 flags;
> int i;
> - int num = sizeof(specific_device_id_tbl) /
> - sizeof(struct specific_device_id);
> + int num = ARRAY_SIZE(specific_device_id_tbl);
>
> for (i = 0; i < num; i++) {
Get rid of the "num" variable and use ARRAY_SIZE() directly.
regards,
dan carpenter
Powered by blists - more mailing lists