]> git.baikalelectronics.ru Git - kernel.git/commit
ia64: fix build error due to switch case label appearing next to declaration
authorJames Morse <james.morse@arm.com>
Tue, 17 Jan 2023 15:16:32 +0000 (15:16 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:23 +0000 (11:28 +0100)
commit09698ac1e2dead9a7a9265e41d5af07d95dee646
tree0e5a1b68737e6cc116bbc665c3508758eaba7fff
parenta447ba12110bf06c5be946da4870acde686bc2f8
ia64: fix build error due to switch case label appearing next to declaration

commit 6f28a2613497fc587e347afa99fa2c52230678a7 upstream.

Since commit 87b7e9b0d723 ("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/20230117151632.393836-1-james.morse@arm.com
Fixes: 87b7e9b0d723 ("ia64: fix clock_getres(CLOCK_MONOTONIC) to report ITC frequency")
Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Sergei Trofimovich <slyich@gmail.com>
Cc: Émeric Maschino <emeric.maschino@gmail.com>
Cc: matoro <matoro_mailinglist_kernel@matoro.tk>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/ia64/kernel/sys_ia64.c