Skip to content

Commit 7d17b29

Browse files
johnhubbardshuahkh
authored andcommitted
selftests/x86: remove (or use) unused variables and functions
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 <[email protected]> Signed-off-by: John Hubbard <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent a89e589 commit 7d17b29

File tree

5 files changed

+2
-28
lines changed

5 files changed

+2
-28
lines changed

tools/testing/selftests/x86/amx.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ struct xsave_buffer {
3939
};
4040
};
4141

42-
static inline uint64_t xgetbv(uint32_t index)
43-
{
44-
uint32_t eax, edx;
45-
46-
asm volatile("xgetbv;"
47-
: "=a" (eax), "=d" (edx)
48-
: "c" (index));
49-
return eax + ((uint64_t)edx << 32);
50-
}
51-
5242
static inline void xsave(struct xsave_buffer *xbuf, uint64_t rfbm)
5343
{
5444
uint32_t rfbm_lo = rfbm;
@@ -164,12 +154,6 @@ static inline void clear_xstate_header(struct xsave_buffer *buffer)
164154
memset(&buffer->header, 0, sizeof(buffer->header));
165155
}
166156

167-
static inline uint64_t get_xstatebv(struct xsave_buffer *buffer)
168-
{
169-
/* XSTATE_BV is at the beginning of the header: */
170-
return *(uint64_t *)&buffer->header;
171-
}
172-
173157
static inline void set_xstatebv(struct xsave_buffer *buffer, uint64_t bv)
174158
{
175159
/* XSTATE_BV is at the beginning of the header: */

tools/testing/selftests/x86/fsgsbase.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ static inline void wrgsbase(unsigned long gsbase)
109109
asm volatile("wrgsbase %0" :: "r" (gsbase) : "memory");
110110
}
111111

112-
static inline void wrfsbase(unsigned long fsbase)
113-
{
114-
asm volatile("wrfsbase %0" :: "r" (fsbase) : "memory");
115-
}
116-
117112
enum which_base { FS, GS };
118113

119114
static unsigned long read_base(enum which_base which)
@@ -212,7 +207,6 @@ static void mov_0_gs(unsigned long initial_base, bool schedule)
212207
}
213208

214209
static volatile unsigned long remote_base;
215-
static volatile bool remote_hard_zero;
216210
static volatile unsigned int ftx;
217211

218212
/*

tools/testing/selftests/x86/syscall_arg_fault.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *),
2929
err(1, "sigaction");
3030
}
3131

32-
static volatile sig_atomic_t sig_traps;
3332
static sigjmp_buf jmpbuf;
3433

3534
static volatile sig_atomic_t n_errs;

tools/testing/selftests/x86/test_vsyscall.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ static inline long sys_gtod(struct timeval *tv, struct timezone *tz)
9797
return syscall(SYS_gettimeofday, tv, tz);
9898
}
9999

100-
static inline int sys_clock_gettime(clockid_t id, struct timespec *ts)
101-
{
102-
return syscall(SYS_clock_gettime, id, ts);
103-
}
104-
105100
static inline long sys_time(time_t *t)
106101
{
107102
return syscall(SYS_time, t);

tools/testing/selftests/x86/vdso_restorer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,6 @@ int main()
9292
printf("[FAIL]\t!SA_SIGINFO handler was not called\n");
9393
nerrs++;
9494
}
95+
96+
return nerrs;
9597
}

0 commit comments

Comments
 (0)