Skip to content

Commit a3bf075

Browse files
nathanchanceshuahkh
authored andcommitted
selftests: pidfd: ksft_exit functions do not return
After commit f7d5bcd ("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_{pass,fail}(), 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. Just removing 'return' would have resulted in !ret ? ksft_exit_pass() : ksft_exit_fail(); so convert that into the more idiomatic if (ret) ksft_exit_fail(); ksft_exit_pass(); Reviewed-by: Muhammad Usama Anjum <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 69e545e commit a3bf075

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

tools/testing/selftests/pidfd/pidfd_fdinfo_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,5 +307,5 @@ int main(int argc, char **argv)
307307
test_pidfd_fdinfo_nspid();
308308
test_pidfd_dead_fdinfo();
309309

310-
return ksft_exit_pass();
310+
ksft_exit_pass();
311311
}

tools/testing/selftests/pidfd/pidfd_open_test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,7 @@ int main(int argc, char **argv)
159159
if (pidfd >= 0)
160160
close(pidfd);
161161

162-
return !ret ? ksft_exit_pass() : ksft_exit_fail();
162+
if (ret)
163+
ksft_exit_fail();
164+
ksft_exit_pass();
163165
}

tools/testing/selftests/pidfd/pidfd_poll_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,5 @@ int main(int argc, char **argv)
112112
}
113113

114114
ksft_test_result_pass("pidfd poll test: pass\n");
115-
return ksft_exit_pass();
115+
ksft_exit_pass();
116116
}

tools/testing/selftests/pidfd/pidfd_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,5 +572,5 @@ int main(int argc, char **argv)
572572
test_pidfd_send_signal_exited_fail();
573573
test_pidfd_send_signal_recycled_pid_fail();
574574

575-
return ksft_exit_pass();
575+
ksft_exit_pass();
576576
}

0 commit comments

Comments
 (0)