Content-Type: multipart/mixed; boundary="===============8286112623097403382==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: [PATCH] ACPI/PCI: fix array_size.cocci warnings Date: Sat, 18 Jul 2020 16:01:45 +0800 Message-ID: <20200718080145.GA55766@adfac4dc55cb> In-Reply-To: List-Id: --===============8286112623097403382== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: kernel test robot 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 Signed-off-by: kernel test robot --- url: https://github.com/0day-ci/linux/commits/sathyanarayanan-kuppuswamy= -linux-intel-com/Simplify-PCIe-native-ownership-detection-logic/20200718-01= 2614 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 =3D sizeof(pci_osc_control_bit) / sizeof(pci_osc_control_bit[0]); + int len =3D ARRAY_SIZE(pci_osc_control_bit); int i =3D 0; = for (i =3D 0; i