Skip to content

Commit 557f137

Browse files
Muhammad Usama Anjumshuahkh
authored andcommitted
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 <usama.anjum@collabora.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 6a56951 commit 557f137

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/testing/selftests/kselftest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static inline __noreturn __printf(1, 2) int ksft_exit_fail_msg(const char *msg,
377377
exit(KSFT_FAIL);
378378
}
379379

380-
static inline void ksft_exit_fail_perror(const char *msg)
380+
static inline __noreturn void ksft_exit_fail_perror(const char *msg)
381381
{
382382
#ifndef NOLIBC
383383
ksft_exit_fail_msg("%s: %s (%d)\n", msg, strerror(errno), errno);

0 commit comments

Comments
 (0)