selftests: timers: ksft_exit functions do not return

After commit f7d5bcd35d ("selftests: kselftest: Mark functions that
unconditionally call exit() as __noreturn"), ksft_exit_...() functions
are marked as __noreturn, which means the return type should not be
'int' but 'void' because they are not returning anything (and never were
since exit() has always been called).

To facilitate updating the return type of these functions, remove
'return' before the calls to ksft_exit_...(), as __noreturn prevents the
compiler from warning that a caller of the ksft_exit functions does not
return a value because the program will terminate upon calling these
functions.

Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Nathan Chancellor 2024-04-24 10:24:11 -07:00 committed by Shuah Khan
parent 102690be45
commit bc7e5d23be
16 changed files with 40 additions and 40 deletions

View File

@ -205,7 +205,7 @@ int main(int argc, char **argv)
adjtimex(&tx1);
if (err)
return ksft_exit_fail();
ksft_exit_fail();
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -173,6 +173,6 @@ int main(void)
timer_delete(tm1);
}
if (final_ret)
return ksft_exit_fail();
return ksft_exit_pass();
ksft_exit_fail();
ksft_exit_pass();
}

View File

@ -89,8 +89,8 @@ int main(int argc, char **argv)
if (ret) {
printf("[FAIL]");
return ksft_exit_fail();
ksft_exit_fail();
}
printf("[OK]");
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -257,7 +257,7 @@ int main(int argc, char **argv)
set_frequency(0.0);
if (fails)
return ksft_exit_fail();
ksft_exit_fail();
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -268,7 +268,7 @@ int main(int argc, char **argv)
if (ret < 0) {
printf("Error: Problem setting STA_INS/STA_DEL!: %s\n",
time_state_str(ret));
return ksft_exit_fail();
ksft_exit_fail();
}
/* Validate STA_INS was set */
@ -277,7 +277,7 @@ int main(int argc, char **argv)
if (tx.status != STA_INS && tx.status != STA_DEL) {
printf("Error: STA_INS/STA_DEL not set!: %s\n",
time_state_str(ret));
return ksft_exit_fail();
ksft_exit_fail();
}
if (tai_time) {
@ -295,7 +295,7 @@ int main(int argc, char **argv)
se.sigev_value.sival_int = 0;
if (timer_create(CLOCK_REALTIME, &se, &tm1) == -1) {
printf("Error: timer_create failed\n");
return ksft_exit_fail();
ksft_exit_fail();
}
its1.it_value.tv_sec = next_leap;
its1.it_value.tv_nsec = 0;
@ -366,7 +366,7 @@ int main(int argc, char **argv)
if (error_found) {
printf("Errors observed\n");
clear_time_state();
return ksft_exit_fail();
ksft_exit_fail();
}
printf("\n");
if ((iterations != -1) && !(--iterations))
@ -374,5 +374,5 @@ int main(int argc, char **argv)
}
clear_time_state();
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -87,7 +87,7 @@ int main(void)
tv.tv_usec = 0;
if (settimeofday(&tv, NULL)) {
printf("Error: You're likely not running with proper (ie: root) permissions\n");
return ksft_exit_fail();
ksft_exit_fail();
}
tx.modes = 0;
adjtimex(&tx);
@ -104,5 +104,5 @@ int main(void)
fflush(stdout);
}
printf("[OK]\n");
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -107,8 +107,8 @@ int main(int argc, char **argv)
ret = mqueue_lat_test();
if (ret < 0) {
printf("[FAILED]\n");
return ksft_exit_fail();
ksft_exit_fail();
}
printf("[OK]\n");
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -260,16 +260,16 @@ int main(int argc, char **argv)
ksft_print_msg("based timers if other threads run on the CPU...\n");
if (check_itimer(ITIMER_VIRTUAL) < 0)
return ksft_exit_fail();
ksft_exit_fail();
if (check_itimer(ITIMER_PROF) < 0)
return ksft_exit_fail();
ksft_exit_fail();
if (check_itimer(ITIMER_REAL) < 0)
return ksft_exit_fail();
ksft_exit_fail();
if (check_timer_create(CLOCK_THREAD_CPUTIME_ID) < 0)
return ksft_exit_fail();
ksft_exit_fail();
/*
* It's unfortunately hard to reliably test a timer expiration
@ -281,10 +281,10 @@ int main(int argc, char **argv)
* find a better solution.
*/
if (check_timer_create(CLOCK_PROCESS_CPUTIME_ID) < 0)
return ksft_exit_fail();
ksft_exit_fail();
if (check_timer_distribution() < 0)
return ksft_exit_fail();
ksft_exit_fail();
ksft_finished();
}

View File

@ -137,11 +137,11 @@ int main(int argc, char **argv)
if (tx1.offset || tx2.offset ||
tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
printf(" [SKIP]\n");
return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
}
printf(" [FAILED]\n");
return ksft_exit_fail();
ksft_exit_fail();
}
printf(" [OK]\n");
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -128,6 +128,6 @@ out:
/* restore clock */
settime(start);
if (ret)
return ksft_exit_fail();
return ksft_exit_pass();
ksft_exit_fail();
ksft_exit_pass();
}

View File

@ -61,9 +61,9 @@ int main(int argc, char **argv)
ret = get_tai();
if (ret != i) {
printf("[FAILED] expected: %i got %i\n", i, ret);
return ksft_exit_fail();
ksft_exit_fail();
}
}
printf("[OK]\n");
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -278,6 +278,6 @@ int main(void)
ret |= do_timer_oneshot(clock_id, 0);
}
if (ret)
return ksft_exit_fail();
return ksft_exit_pass();
ksft_exit_fail();
ksft_exit_pass();
}

View File

@ -102,9 +102,9 @@ int main(int argc, char **argv)
printf("[OK]\n");
set_tz(min, dst);
return ksft_exit_pass();
ksft_exit_pass();
err:
set_tz(min, dst);
return ksft_exit_fail();
ksft_exit_fail();
}

View File

@ -70,8 +70,8 @@ int main(int argc, char **argv)
if (ret) {
printf("[FAILED]\n");
return ksft_exit_fail();
ksft_exit_fail();
}
printf("[OK]\n");
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -189,5 +189,5 @@ out:
/* die */
if (ret)
ksft_exit_fail();
return ksft_exit_pass();
ksft_exit_pass();
}

View File

@ -320,10 +320,10 @@ int validate_set_offset(void)
int main(int argc, char **argv)
{
if (validate_freq())
return ksft_exit_fail();
ksft_exit_fail();
if (validate_set_offset())
return ksft_exit_fail();
ksft_exit_fail();
return ksft_exit_pass();
ksft_exit_pass();
}