public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: avoid unused-variable warning
@ 2026-03-13  9:49 Arnd Bergmann
  2026-03-13 11:07 ` Vincent Donnefort
  2026-03-17  9:17 ` Marc Zyngier
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-03-13  9:49 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton, Vincent Donnefort
  Cc: Arnd Bergmann, Joey Gouly, Suzuki K Poulose, Zenghui Yu,
	Catalin Marinas, Will Deacon, linux-arm-kernel, kvmarm,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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>
---
 arch/arm64/kvm/hyp_trace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kvm/hyp_trace.c b/arch/arm64/kvm/hyp_trace.c
index c1e28f6581ab..8b7f2bf2fba8 100644
--- a/arch/arm64/kvm/hyp_trace.c
+++ b/arch/arm64/kvm/hyp_trace.c
@@ -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();
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm64: avoid unused-variable warning
  2026-03-13  9:49 [PATCH] KVM: arm64: avoid unused-variable warning Arnd Bergmann
@ 2026-03-13 11:07 ` Vincent Donnefort
  2026-03-17  9:17 ` Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent Donnefort @ 2026-03-13 11:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Marc Zyngier, Oliver Upton, Arnd Bergmann, Joey Gouly,
	Suzuki K Poulose, Zenghui Yu, Catalin Marinas, Will Deacon,
	linux-arm-kernel, kvmarm, linux-kernel

On Fri, Mar 13, 2026 at 10:49:16AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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>
> ---
>  arch/arm64/kvm/hyp_trace.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp_trace.c b/arch/arm64/kvm/hyp_trace.c
> index c1e28f6581ab..8b7f2bf2fba8 100644
> --- a/arch/arm64/kvm/hyp_trace.c
> +++ b/arch/arm64/kvm/hyp_trace.c
> @@ -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();

Reviewed-by: Vincent Donnefort <vdonnefort@google.com>

>  
> -- 
> 2.39.5
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm64: avoid unused-variable warning
  2026-03-13  9:49 [PATCH] KVM: arm64: avoid unused-variable warning Arnd Bergmann
  2026-03-13 11:07 ` Vincent Donnefort
@ 2026-03-17  9:17 ` Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2026-03-17  9:17 UTC (permalink / raw)
  To: Oliver Upton, Vincent Donnefort, Arnd Bergmann
  Cc: Arnd Bergmann, Joey Gouly, Suzuki K Poulose, Zenghui Yu,
	Catalin Marinas, Will Deacon, linux-arm-kernel, kvmarm,
	linux-kernel

On Fri, 13 Mar 2026 10:49:16 +0100, Arnd Bergmann wrote:
> 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;
>       |             ^~~
> 
> [...]

Applied to next, thanks!

[1/1] KVM: arm64: avoid unused-variable warning
      commit: 8510d054b7e086a71a9191ac3399231290dfd272

Cheers,

	M.
-- 
Without deviation from the norm, progress is not possible.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-17  9:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13  9:49 [PATCH] KVM: arm64: avoid unused-variable warning Arnd Bergmann
2026-03-13 11:07 ` Vincent Donnefort
2026-03-17  9:17 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox