Skip to contentSkip to conversation

KVM: arm64: avoid unused-variable warning

PATCH Applied Arnd Bergmann 3 participants 3 messages Mar 13 – Mar 17

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm64: avoid unused-variable warning

From: Arnd Bergmann <[email protected]>

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")
---
 arch/arm64/kvm/hyp_trace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/kvm/hyp_trace.c +2 -3
index c1e28f6581ab..8b7f2bf2fba8 100644
@@ -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();
 
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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")
---
 arch/arm64/kvm/hyp_trace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/kvm/hyp_trace.c +0 -1
index c1e28f6581ab..8b7f2bf2fba8 100644
@@ -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);
 

arch/arm64/kvm/hyp_trace.c int __init kvm_hyp_trace_init(void) · line 438

Quoted 10 lines
arch/arm64/kvm/hyp_trace.c +2 -2
-		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();
Quoted 4 lines
Signature · 2 lines
-- 
2.39.5
maintainer Applied
#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

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.
Signature · 1 line
Without deviation from the norm, progress is not possible.