Skip to content

Commit 557f137

Browse files
musamaanjumshuahkh
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 <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 6a56951 commit 557f137

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)