diff --git a/tools/testing/selftests/bpf/prog_tests/get_branch_snapshot.c b/tools/testing/selftests/bpf/prog_tests/get_branch_snapshot.c index f81db9135ae4..67e86f8d8677 100644 --- a/tools/testing/selftests/bpf/prog_tests/get_branch_snapshot.c +++ b/tools/testing/selftests/bpf/prog_tests/get_branch_snapshot.c @@ -38,10 +38,9 @@ static int create_perf_events(void) static void close_perf_events(void) { - int cpu = 0; - int fd; + int cpu, fd; - while (cpu++ < cpu_cnt) { + for (cpu = 0; cpu < cpu_cnt; cpu++) { fd = pfd_array[cpu]; if (fd < 0) break;