lkml.org 
[lkml]   [2020]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ACPI/PCI: fix array_size.cocci warnings
From: kernel test robot <lkp@intel.com>

drivers/acpi/pci_root.c:150:37-38: WARNING: Use ARRAY_SIZE

Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
This makes an effort to find cases where ARRAY_SIZE can be used such as
where there is a division of sizeof the array by the sizeof its first
element or by any indexed element or the element type. It replaces the
division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

CC: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

url: https://github.com/0day-ci/linux/commits/sathyanarayanan-kuppuswamy-linux-intel-com/Simplify-PCIe-native-ownership-detection-logic/20200718-012614
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next

pci_root.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -147,7 +147,7 @@ static struct pci_osc_bit_struct pci_osc

static char *get_osc_desc(u32 bit)
{
- int len = sizeof(pci_osc_control_bit) / sizeof(pci_osc_control_bit[0]);
+ int len = ARRAY_SIZE(pci_osc_control_bit);
int i = 0;

for (i = 0; i <len; i++)
\
 
 \ /
  Last update: 2020-07-18 10:03    [W:0.054 / U:0.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site