Commit 8510d054 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Marc Zyngier
Browse files

KVM: arm64: avoid unused-variable warning



The 'cpu' variable is only used inside of an #ifdef block and causes
a warning if there is no user:

arch/arm64/kvm/hyp_trace.c: In function 'kvm_hyp_trace_init':
arch/arm64/kvm/hyp_trace.c:422:13: error: unused variable 'cpu' [-Werror=unused-variable]
  422 |         int cpu;
      |             ^~~

Change the #ifdef to an equivalent IS_ENABLED() check to avoid
the warning.

Fixes: b2288891 ("KVM: arm64: Sync boot clock with the nVHE/pKVM hyp")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarVincent Donnefort <vdonnefort@google.com>
Link: https://patch.msgid.link/20260313094925.3749287-1-arnd@kernel.org


Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 1211907a
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -424,17 +424,16 @@ int __init kvm_hyp_trace_init(void)
	if (is_kernel_in_hyp_mode())
		return 0;

#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
	for_each_possible_cpu(cpu) {
		const struct arch_timer_erratum_workaround *wa =
			per_cpu(timer_unstable_counter_workaround, cpu);

		if (wa && wa->read_cntvct_el0) {
		if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND) &&
		    wa && wa->read_cntvct_el0) {
			pr_warn("hyp trace can't handle CNTVCT workaround '%s'\n", wa->desc);
			return -EOPNOTSUPP;
		}
	}
#endif

	hyp_trace_init_events();