lkml.org 
[lkml]   [2021]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2] staging: r8188eu: use ARRAY_SIZE
Date
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
\
 
 \ /
  Last update: 2021-09-18 05:40    [W:0.040 / U:0.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site