[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210918062206.GN2088@kadam>
Date: Sat, 18 Sep 2021 09:22:06 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: cgel.zte@...il.com
Cc: Larry.Finger@...inger.net, phil@...lpotter.co.uk,
gregkh@...uxfoundation.org, straube.linux@...il.com,
martin@...ser.cx, paskripkin@...il.com, nathan@...nel.org,
saurav.girepunje@...il.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Changcheng Deng <deng.changcheng@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH V2] staging: r8188eu: use ARRAY_SIZE
On Sat, Sep 18, 2021 at 03:39:10AM +0000, cgel.zte@...il.com 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 | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
> index d04d2f658ce0..44bee3b2d0ce 100644
> --- a/drivers/staging/r8188eu/os_dep/usb_intf.c
> +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
> @@ -261,10 +261,8 @@ 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);
>
> - for (i = 0; i < num; i++) {
> + for (i = 0; i < ARRAY_SIZE(specific_device_id_tbl); i++) {
I'm sorry that I didn't review this carefully the first time, but the
specific_device_id_tbl[] array is empty. This whole function should
just be deleted.
regards,
dan carpenter
Powered by blists - more mailing lists