Skip to content

Commit 6f28a26

Browse files
James Morseakpm00
authored andcommitted
ia64: fix build error due to switch case label appearing next to declaration
Since commit aa06a9b ("ia64: fix clock_getres(CLOCK_MONOTONIC) to report ITC frequency"), gcc 10.1.0 fails to build ia64 with the gnomic: | ../arch/ia64/kernel/sys_ia64.c: In function 'ia64_clock_getres': | ../arch/ia64/kernel/sys_ia64.c:189:3: error: a label can only be part of a statement and a declaration is not a statement | 189 | s64 tick_ns = DIV_ROUND_UP(NSEC_PER_SEC, local_cpu_data->itc_freq); This line appears immediately after a case label in a switch. Move the declarations out of the case, to the top of the function. Link: https://lkml.kernel.org/r/[email protected] Fixes: aa06a9b ("ia64: fix clock_getres(CLOCK_MONOTONIC) to report ITC frequency") Signed-off-by: James Morse <[email protected]> Reviewed-by: Sergei Trofimovich <[email protected]> Cc: Émeric Maschino <[email protected]> Cc: matoro <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent de08eaa commit 6f28a26

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/ia64/kernel/sys_ia64.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, u
170170
asmlinkage long
171171
ia64_clock_getres(const clockid_t which_clock, struct __kernel_timespec __user *tp)
172172
{
173+
struct timespec64 rtn_tp;
174+
s64 tick_ns;
175+
173176
/*
174177
* ia64's clock_gettime() syscall is implemented as a vdso call
175178
* fsys_clock_gettime(). Currently it handles only
@@ -185,8 +188,8 @@ ia64_clock_getres(const clockid_t which_clock, struct __kernel_timespec __user *
185188
switch (which_clock) {
186189
case CLOCK_REALTIME:
187190
case CLOCK_MONOTONIC:
188-
s64 tick_ns = DIV_ROUND_UP(NSEC_PER_SEC, local_cpu_data->itc_freq);
189-
struct timespec64 rtn_tp = ns_to_timespec64(tick_ns);
191+
tick_ns = DIV_ROUND_UP(NSEC_PER_SEC, local_cpu_data->itc_freq);
192+
rtn_tp = ns_to_timespec64(tick_ns);
190193
return put_timespec64(&rtn_tp, tp);
191194
}
192195

0 commit comments

Comments
 (0)