]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/x86: remove (or use) unused variables and functions
authorJohn Hubbard <jhubbard@nvidia.com>
Thu, 4 Jul 2024 07:24:30 +0000 (00:24 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 11 Jul 2024 17:23:55 +0000 (11:23 -0600)
When building with clang, via:

    make LLVM=1 -C tools/testing/selftests

...quite a few functions are variables are generating "unused" warnings.
Fix the warnings by deleting the unused items.

One item, the "nerrs" variable in vsdo_restorer.c's main(), is unused
but probably wants to be returned from main(), as a non-zero result.
That result is also unused right now, so another option would be to
delete it entirely, but this way, main() also gets fixed. It was missing
a return value.

Acked-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/x86/amx.c
tools/testing/selftests/x86/fsgsbase.c
tools/testing/selftests/x86/syscall_arg_fault.c
tools/testing/selftests/x86/test_vsyscall.c
tools/testing/selftests/x86/vdso_restorer.c

index 95aad6d8849beb70b7b50afda143587e33fd3e62..1fdf35a4d7f632388cd21fe491036fcd65488620 100644 (file)
@@ -39,16 +39,6 @@ struct xsave_buffer {
        };
 };
 
-static inline uint64_t xgetbv(uint32_t index)
-{
-       uint32_t eax, edx;
-
-       asm volatile("xgetbv;"
-                    : "=a" (eax), "=d" (edx)
-                    : "c" (index));
-       return eax + ((uint64_t)edx << 32);
-}
-
 static inline void xsave(struct xsave_buffer *xbuf, uint64_t rfbm)
 {
        uint32_t rfbm_lo = rfbm;
@@ -164,12 +154,6 @@ static inline void clear_xstate_header(struct xsave_buffer *buffer)
        memset(&buffer->header, 0, sizeof(buffer->header));
 }
 
-static inline uint64_t get_xstatebv(struct xsave_buffer *buffer)
-{
-       /* XSTATE_BV is at the beginning of the header: */
-       return *(uint64_t *)&buffer->header;
-}
-
 static inline void set_xstatebv(struct xsave_buffer *buffer, uint64_t bv)
 {
        /* XSTATE_BV is at the beginning of the header: */
index 8c780cce941daaedca46985678571ed0476549a7..50cf32de631397edc935414be478bf0143993769 100644 (file)
@@ -109,11 +109,6 @@ static inline void wrgsbase(unsigned long gsbase)
        asm volatile("wrgsbase %0" :: "r" (gsbase) : "memory");
 }
 
-static inline void wrfsbase(unsigned long fsbase)
-{
-       asm volatile("wrfsbase %0" :: "r" (fsbase) : "memory");
-}
-
 enum which_base { FS, GS };
 
 static unsigned long read_base(enum which_base which)
@@ -212,7 +207,6 @@ static void mov_0_gs(unsigned long initial_base, bool schedule)
 }
 
 static volatile unsigned long remote_base;
-static volatile bool remote_hard_zero;
 static volatile unsigned int ftx;
 
 /*
index 461fa41a4d02aad8c579d9f1287bec16fc155475..48ab065a76f9bcd92f1037bfb548938419eb0c8a 100644 (file)
@@ -29,7 +29,6 @@ static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *),
                err(1, "sigaction");
 }
 
-static volatile sig_atomic_t sig_traps;
 static sigjmp_buf jmpbuf;
 
 static volatile sig_atomic_t n_errs;
index d4c8e8d79d3898f8f9ba6e87a621750e94a2c89f..1c9895cfc660b417881ae1529a169073d8c4c7fb 100644 (file)
@@ -97,11 +97,6 @@ static inline long sys_gtod(struct timeval *tv, struct timezone *tz)
        return syscall(SYS_gettimeofday, tv, tz);
 }
 
-static inline int sys_clock_gettime(clockid_t id, struct timespec *ts)
-{
-       return syscall(SYS_clock_gettime, id, ts);
-}
-
 static inline long sys_time(time_t *t)
 {
        return syscall(SYS_time, t);
index fe99f24341554ccafad2cc87e666e82781751e53..ac8d8e1e9805d0a91cb08da651acf64fa74cf56b 100644 (file)
@@ -92,4 +92,6 @@ int main()
                printf("[FAIL]\t!SA_SIGINFO handler was not called\n");
                nerrs++;
        }
+
+       return nerrs;
 }