Fix the `int i` declaration inside the for statement. This is non-C89 compliant. Doing all of them in this change since they are trivial. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> --- tools/testing/selftests/bpf/prog_tests/d_path.c | 4 ++-- tools/testing/selftests/bpf/prog_tests/timer_mim.c | 6 +++--- tools/testing/selftests/bpf/prog_tests/xdp_bonding.c | 4 ++-- tools/testing/selftests/bpf/test_progs.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/d_path.c b/tools/testing/selftests/bpf/prog_tests/d_path.c index 0a577a248d34..cc787ad68081 100644 --- a/tools/testing/selftests/bpf/prog_tests/d_path.c +++ b/tools/testing/selftests/bpf/prog_tests/d_path.c @@ -103,7 +103,7 @@ void test_d_path(void) { struct test_d_path__bss *bss; struct test_d_path *skel; - int err; + int err, i; skel = test_d_path__open_and_load(); if (CHECK(!skel, "setup", "d_path skeleton failed\n")) @@ -130,7 +130,7 @@ void test_d_path(void) "trampoline for filp_close was not called\n")) goto cleanup; - for (int i = 0; i < MAX_FILES; i++) { + for (i = 0; i < MAX_FILES; i++) { CHECK(strncmp(src.paths[i], bss->paths_stat[i], MAX_PATH_LEN), "check", "failed to get stat path[%d]: %s vs %s\n", diff --git a/tools/testing/selftests/bpf/prog_tests/timer_mim.c b/tools/testing/selftests/bpf/prog_tests/timer_mim.c index 949a0617869d..f12536c32e2d 100644 --- a/tools/testing/selftests/bpf/prog_tests/timer_mim.c +++ b/tools/testing/selftests/bpf/prog_tests/timer_mim.c @@ -6,9 +6,9 @@ static int timer_mim(struct timer_mim *timer_skel) { + int err, prog_fd, key1 = 1, i; __u32 duration = 0, retval; __u64 cnt1, cnt2; - int err, prog_fd, key1 = 1; err = timer_mim__attach(timer_skel); if (!ASSERT_OK(err, "timer_attach")) @@ -23,7 +23,7 @@ static int timer_mim(struct timer_mim *timer_skel) /* check that timer_cb[12] are incrementing 'cnt' */ cnt1 = READ_ONCE(timer_skel->bss->cnt); - for (int i = 0; i < 100; i++) { + for (i = 0; i < 100; i++) { cnt2 = READ_ONCE(timer_skel->bss->cnt); if (cnt2 != cnt1) break; @@ -41,7 +41,7 @@ static int timer_mim(struct timer_mim *timer_skel) /* check that timer_cb[12] are no longer running */ cnt1 = READ_ONCE(timer_skel->bss->cnt); - for (int i = 0; i < 100; i++) { + for (i = 0; i < 100; i++) { usleep(200); /* 100 times more than interval */ cnt2 = READ_ONCE(timer_skel->bss->cnt); if (cnt2 == cnt1) diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c index faa22b84f2ee..e5b8666e59eb 100644 --- a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c +++ b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c @@ -335,7 +335,7 @@ static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons) { static const char * const ifaces[] = {"bond2", "veth2_1", "veth2_2"}; int veth1_1_rx, veth1_2_rx; - int err; + int err, i; if (bonding_setup(skeletons, BOND_MODE_ROUNDROBIN, BOND_XMIT_POLICY_LAYER23, BOND_ONE_NO_ATTACH)) @@ -346,7 +346,7 @@ static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons) goto out; /* populate the devmap with the relevant interfaces */ - for (int i = 0; i < ARRAY_SIZE(ifaces); i++) { + for (i = 0; i < ARRAY_SIZE(ifaces); i++) { int ifindex = if_nametoindex(ifaces[i]); int map_fd = bpf_map__fd(skeletons->xdp_redirect_multi_kern->maps.map_all); diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index c65986bd9d07..0096051e7560 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -1146,7 +1146,7 @@ static int server_main(void) /* run serial tests */ save_netns(); - for (int i = 0; i < prog_test_cnt; i++) { + for (i = 0; i < prog_test_cnt; i++) { struct prog_test_def *test = &prog_test_defs[i]; struct test_result *result = &test_results[i]; -- 2.33.1