All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] staging: r8188eu: use ARRAY_SIZE
@ 2021-09-18  3:39 cgel.zte
  2021-09-18  6:22 ` Dan Carpenter
  2021-09-18  6:51 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2021-09-18  3:39 UTC (permalink / raw)
  To: Larry.Finger, dan.carpenter
  Cc: phil, gregkh, straube.linux, martin, paskripkin, nathan,
	saurav.girepunje, linux-staging, linux-kernel, Changcheng Deng,
	Zeal Robot

From: Changcheng Deng <deng.changcheng@zte.com.cn>

Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.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++) {
 		vid = specific_device_id_tbl[i].idVendor;
 		pid = specific_device_id_tbl[i].idProduct;
 		flags = specific_device_id_tbl[i].flags;
-- 
2.25.1


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

* Re: [PATCH V2] staging: r8188eu: use ARRAY_SIZE
  2021-09-18  3:39 [PATCH V2] staging: r8188eu: use ARRAY_SIZE cgel.zte
@ 2021-09-18  6:22 ` Dan Carpenter
  2021-09-18  6:51 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-09-18  6:22 UTC (permalink / raw)
  To: cgel.zte
  Cc: Larry.Finger, phil, gregkh, straube.linux, martin, paskripkin,
	nathan, saurav.girepunje, linux-staging, linux-kernel,
	Changcheng Deng, Zeal Robot

On Sat, Sep 18, 2021 at 03:39:10AM +0000, cgel.zte@gmail.com wrote:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
> 
> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.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



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

* Re: [PATCH V2] staging: r8188eu: use ARRAY_SIZE
  2021-09-18  3:39 [PATCH V2] staging: r8188eu: use ARRAY_SIZE cgel.zte
  2021-09-18  6:22 ` Dan Carpenter
@ 2021-09-18  6:51 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-09-18  6:51 UTC (permalink / raw)
  To: cgel.zte
  Cc: Larry.Finger, dan.carpenter, phil, straube.linux, martin,
	paskripkin, nathan, saurav.girepunje, linux-staging,
	linux-kernel, Changcheng Deng, Zeal Robot

On Sat, Sep 18, 2021 at 03:39:10AM +0000, cgel.zte@gmail.com wrote:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
> 
> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.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++) {
>  		vid = specific_device_id_tbl[i].idVendor;
>  		pid = specific_device_id_tbl[i].idProduct;
>  		flags = specific_device_id_tbl[i].flags;
> -- 
> 2.25.1
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/SubmittingPatches for what needs to be done
  here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

end of thread, other threads:[~2021-09-18  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18  3:39 [PATCH V2] staging: r8188eu: use ARRAY_SIZE cgel.zte
2021-09-18  6:22 ` Dan Carpenter
2021-09-18  6:51 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.