selftests/mm: ksft_exit functions do not return
authorNathan Chancellor <nathan@kernel.org>
Wed, 24 Apr 2024 17:24:07 +0000 (10:24 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 May 2024 19:57:20 +0000 (13:57 -0600)
After commit f7d5bcd35d42 ("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>
tools/testing/selftests/mm/compaction_test.c
tools/testing/selftests/mm/cow.c
tools/testing/selftests/mm/gup_longterm.c
tools/testing/selftests/mm/gup_test.c
tools/testing/selftests/mm/ksm_functional_tests.c
tools/testing/selftests/mm/madv_populate.c
tools/testing/selftests/mm/mkdirty.c
tools/testing/selftests/mm/pagemap_ioctl.c
tools/testing/selftests/mm/soft-dirty.c

index 533999b6c284448360948bf4471f6e8c5b1c5aa5..4f42eb7d7636966c381d0c91ca78bb0c01720b48 100644 (file)
@@ -177,7 +177,7 @@ int main(int argc, char **argv)
        ksft_print_header();
 
        if (prereq() || geteuid())
-               return ksft_exit_skip("Prerequisites unsatisfied\n");
+               ksft_exit_skip("Prerequisites unsatisfied\n");
 
        ksft_set_plan(1);
 
@@ -225,7 +225,7 @@ int main(int argc, char **argv)
        }
 
        if (check_compaction(mem_free, hugepage_size) == 0)
-               return ksft_exit_pass();
+               ksft_exit_pass();
 
-       return ksft_exit_fail();
+       ksft_exit_fail();
 }
index 363bf5f801be5f579dc6e32683401d9009ae002d..fe078d6e1806492e05057e2a58705365e3e0e173 100644 (file)
@@ -1779,5 +1779,5 @@ int main(int argc, char **argv)
        if (err)
                ksft_exit_fail_msg("%d out of %d tests failed\n",
                                   err, ksft_test_num());
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }
index ad168d35b23b7d187d545c1aeb3c635073fb8b38..d7eaca5bbe9b1e11fa35295be1c3e23274252494 100644 (file)
@@ -456,5 +456,5 @@ int main(int argc, char **argv)
        if (err)
                ksft_exit_fail_msg("%d out of %d tests failed\n",
                                   err, ksft_test_num());
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }
index 18a49c70d4c6354baac96073bc99446ad70b0b85..bd335cf9bc0e18facbe3b9b0263acf0b9e1dd7c1 100644 (file)
@@ -228,7 +228,7 @@ int main(int argc, char **argv)
                        break;
                }
                ksft_test_result_skip("Please run this test as root\n");
-               return ksft_exit_pass();
+               ksft_exit_pass();
        }
 
        p = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, filed, 0);
@@ -267,5 +267,5 @@ int main(int argc, char **argv)
 
        free(tid);
 
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }
index d615767e396bec5f6f61fe9625c1f01008ee8939..508287560c455de66dd3461d3ffe7415c2e7b500 100644 (file)
@@ -646,5 +646,5 @@ int main(int argc, char **argv)
        if (err)
                ksft_exit_fail_msg("%d out of %d tests failed\n",
                                   err, ksft_test_num());
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }
index 17bcb07f19f3491b074e32442b47ec0ddff29278..ef7d911da13e01bd6096272787c4bfd0c2bed383 100644 (file)
@@ -307,5 +307,5 @@ int main(int argc, char **argv)
        if (err)
                ksft_exit_fail_msg("%d out of %d tests failed\n",
                                   err, ksft_test_num());
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }
index 301abb99e027e2ed4c22078f8b9c732d2dfca7a3..b8a7efe9204ea1e39c14a4bda1e9c71d688b9128 100644 (file)
@@ -375,5 +375,5 @@ int main(void)
        if (err)
                ksft_exit_fail_msg("%d out of %d tests failed\n",
                                   err, ksft_test_num());
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }
index d59517ed3d48bdb25c94cecbae991fea1acb5108..2d785aca72a5c250e0306c7e11f678d5af7f0bdb 100644 (file)
@@ -1484,7 +1484,7 @@ int main(int argc, char *argv[])
        ksft_print_header();
 
        if (init_uffd())
-               return ksft_exit_pass();
+               ksft_exit_pass();
 
        ksft_set_plan(115);
 
@@ -1660,5 +1660,5 @@ int main(int argc, char *argv[])
        userfaultfd_tests();
 
        close(pagemap_fd);
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }
index 7dbfa53d93a05f504ea4c1019bce92677cec136d..d9dbf879748b222cfbe48df8e94477d58da56931 100644 (file)
@@ -209,5 +209,5 @@ int main(int argc, char **argv)
 
        close(pagemap_fd);
 
-       return ksft_exit_pass();
+       ksft_exit_pass();
 }