From 557f1375275e04ef92d22aa14203e4b763fbd22b Mon Sep 17 00:00:00 2001 From: Muhammad Usama Anjum Date: Sun, 14 Apr 2024 11:26:53 +0500 Subject: [PATCH] selftests: Mark ksft_exit_fail_perror() as __noreturn Let the compilers (clang) know that this function would just call exit() and would never return. It is needed to avoid false positive static analysis errors. All similar functions calling exit() unconditionally have been marked as __noreturn. Signed-off-by: Muhammad Usama Anjum Reviewed-by: Nathan Chancellor Signed-off-by: Shuah Khan --- tools/testing/selftests/kselftest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 0a983b27771e1..3d2256885cffb 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -377,7 +377,7 @@ static inline __noreturn __printf(1, 2) int ksft_exit_fail_msg(const char *msg, exit(KSFT_FAIL); } -static inline void ksft_exit_fail_perror(const char *msg) +static inline __noreturn void ksft_exit_fail_perror(const char *msg) { #ifndef NOLIBC ksft_exit_fail_msg("%s: %s (%d)\n", msg, strerror(errno), errno); -- 2.30.2