Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: b22888917fa4 ("KVM: arm64: Sync boot clock with the nVHE/pKVM hyp")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
Link: https://patch.msgid.link/20260313094925.3749287-1-arnd@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>

authored by

Arnd Bergmann and committed by
Marc Zyngier
8510d054 1211907a

+2 -3
+2 -3
arch/arm64/kvm/hyp_trace.c
··· 424 424 if (is_kernel_in_hyp_mode()) 425 425 return 0; 426 426 427 - #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND 428 427 for_each_possible_cpu(cpu) { 429 428 const struct arch_timer_erratum_workaround *wa = 430 429 per_cpu(timer_unstable_counter_workaround, cpu); 431 430 432 - if (wa && wa->read_cntvct_el0) { 431 + if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND) && 432 + wa && wa->read_cntvct_el0) { 433 433 pr_warn("hyp trace can't handle CNTVCT workaround '%s'\n", wa->desc); 434 434 return -EOPNOTSUPP; 435 435 } 436 436 } 437 - #endif 438 437 439 438 hyp_trace_init_events(); 440 439