]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - tools/testing/selftests/kselftest.h
Merge tag 'net-6.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[thirdparty/linux.git] / tools / testing / selftests / kselftest.h
index 7b89362da4bfd384efe49681451c276ecd78ee16..14bbab0cce13521abbcae9bbd3772a567239c77f 100644 (file)
@@ -292,15 +292,17 @@ void ksft_test_result_code(int exit_code, const char *test_name,
        }
 
        /* Docs seem to call for double space if directive is absent */
-       if (!directive[0] && msg[0])
+       if (!directive[0] && msg)
                directive = " #  ";
 
-       va_start(args, msg);
        printf("%s %u %s%s", tap_code, ksft_test_num(), test_name, directive);
        errno = saved_errno;
-       vprintf(msg, args);
+       if (msg) {
+               va_start(args, msg);
+               vprintf(msg, args);
+               va_end(args);
+       }
        printf("\n");
-       va_end(args);
 }
 
 static inline __noreturn int ksft_exit_pass(void)