* [PATCH] powerpc: Use ARRAY_SIZE for array length
@ 2023-11-22 9:03 Jiapeng Chong
2023-11-23 0:26 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-11-22 9:03 UTC (permalink / raw)
To: mpe; +Cc: Jiapeng Chong, Abaci Robot, linux-kernel, npiggin, linuxppc-dev
Use of macro ARRAY_SIZE to calculate array size minimizes
the redundant code and improves code reusability.
./arch/powerpc/xmon/ppc-opc.c:957:67-68: WARNING: Use ARRAY_SIZE.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7612
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
arch/powerpc/xmon/ppc-opc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c
index 0774d711453e..d409d6113f82 100644
--- a/arch/powerpc/xmon/ppc-opc.c
+++ b/arch/powerpc/xmon/ppc-opc.c
@@ -954,8 +954,7 @@ const struct powerpc_operand powerpc_operands[] =
{ 0xff, 11, NULL, NULL, PPC_OPERAND_SIGNOPT },
};
-const unsigned int num_powerpc_operands = (sizeof (powerpc_operands)
- / sizeof (powerpc_operands[0]));
+const unsigned int num_powerpc_operands = ARRAY_SIZE(powerpc_operands);
/* The functions used to insert and extract complicated operands. */
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc: Use ARRAY_SIZE for array length
2023-11-22 9:03 [PATCH] powerpc: Use ARRAY_SIZE for array length Jiapeng Chong
@ 2023-11-23 0:26 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2023-11-23 0:26 UTC (permalink / raw)
To: Jiapeng Chong
Cc: Jiapeng Chong, Abaci Robot, linux-kernel, npiggin, linuxppc-dev
Jiapeng Chong <jiapeng.chong@linux.alibaba.com> writes:
> Use of macro ARRAY_SIZE to calculate array size minimizes
> the redundant code and improves code reusability.
>
> ./arch/powerpc/xmon/ppc-opc.c:957:67-68: WARNING: Use ARRAY_SIZE.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7612
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> arch/powerpc/xmon/ppc-opc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
This code is copied from binutils, we don't take cleanup patches to it.
See also the at least three times this has already been submitted :)
https://lore.kernel.org/all/4ed43222-17b0-8355-f836-adabb453e432@csgroup.eu/
https://lore.kernel.org/linuxppc-dev/20181004171036.GA1907@embeddedor.com/
https://lore.kernel.org/linuxppc-dev/874lfxjnzl.fsf@concordia.ellerman.id.au/
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-23 0:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 9:03 [PATCH] powerpc: Use ARRAY_SIZE for array length Jiapeng Chong
2023-11-23 0:26 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).