Commit 8ff88bec authored by Guo Zhengkui's avatar Guo Zhengkui Committed by Shuah Khan

selftests/vDSO: fix array_size.cocci warning

Fix the following coccicheck warning:

tools/testing/selftests/vDSO/vdso_test_correctness.c:309:46-47:
WARNING: Use ARRAY_SIZE
tools/testing/selftests/vDSO/vdso_test_correctness.c:373:46-47:
WARNING: Use ARRAY_SIZE

It has been tested with gcc (Debian 8.3.0-6) 8.3.0 on x86_64.
Signed-off-by: default avatarGuo Zhengkui <guozhengkui@vivo.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 31231092
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <limits.h> #include <limits.h>
#include "vdso_config.h" #include "vdso_config.h"
#include "../kselftest.h"
static const char **name; static const char **name;
...@@ -306,10 +307,8 @@ static void test_clock_gettime(void) ...@@ -306,10 +307,8 @@ static void test_clock_gettime(void)
return; return;
} }
for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]); for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
clock++) {
test_one_clock_gettime(clock, clocknames[clock]); test_one_clock_gettime(clock, clocknames[clock]);
}
/* Also test some invalid clock ids */ /* Also test some invalid clock ids */
test_one_clock_gettime(-1, "invalid"); test_one_clock_gettime(-1, "invalid");
...@@ -370,10 +369,8 @@ static void test_clock_gettime64(void) ...@@ -370,10 +369,8 @@ static void test_clock_gettime64(void)
return; return;
} }
for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]); for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
clock++) {
test_one_clock_gettime64(clock, clocknames[clock]); test_one_clock_gettime64(clock, clocknames[clock]);
}
/* Also test some invalid clock ids */ /* Also test some invalid clock ids */
test_one_clock_gettime64(-1, "invalid"); test_one_clock_gettime64(-1, "invalid");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment