lkml.org 
[lkml]   [2019]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.
Date
From: Allen Pais <allen.lkml@gmail.com>

This issue was detected with the help of Coccinelle.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
arch/s390/tools/gen_opcode_table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/tools/gen_opcode_table.c b/arch/s390/tools/gen_opcode_table.c
index a1bc02b29c81..468b70c85f62 100644
--- a/arch/s390/tools/gen_opcode_table.c
+++ b/arch/s390/tools/gen_opcode_table.c
@@ -138,7 +138,7 @@ static struct insn_type *insn_format_to_type(char *format)
strcpy(tmp, format);
base_format = tmp;
base_format = strsep(&base_format, "_");
- for (i = 0; i < sizeof(insn_type_table) / sizeof(insn_type_table[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(insn_type_table); i++) {
ptr = insn_type_table[i].format;
while (*ptr) {
if (!strcmp(base_format, *ptr))
--
2.19.1
\
 
 \ /
  Last update: 2019-02-08 03:42    [W:0.050 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site