Skip to content

Commit 8ff88be

Browse files
Guo Zhengkuishuahkh
authored andcommitted
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: Guo Zhengkui <guozhengkui@vivo.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 3123109 commit 8ff88be

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

tools/testing/selftests/vDSO/vdso_test_correctness.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <limits.h>
2121

2222
#include "vdso_config.h"
23+
#include "../kselftest.h"
2324

2425
static const char **name;
2526

@@ -306,10 +307,8 @@ static void test_clock_gettime(void)
306307
return;
307308
}
308309

309-
for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
310-
clock++) {
310+
for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
311311
test_one_clock_gettime(clock, clocknames[clock]);
312-
}
313312

314313
/* Also test some invalid clock ids */
315314
test_one_clock_gettime(-1, "invalid");
@@ -370,10 +369,8 @@ static void test_clock_gettime64(void)
370369
return;
371370
}
372371

373-
for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
374-
clock++) {
372+
for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
375373
test_one_clock_gettime64(clock, clocknames[clock]);
376-
}
377374

378375
/* Also test some invalid clock ids */
379376
test_one_clock_gettime64(-1, "invalid");

0 commit comments

Comments
 (0)