diff mbox

KVM: Eliminate unused variable warning on uniprocessor configs

Message ID 20170511034013.GB14071@fergus.ozlabs.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paul Mackerras May 11, 2017, 3:40 a.m. UTC
Commit 7a97cec26b94 ("KVM: mark requests that need synchronization",
2017-04-27) added a variable 'wait' to kvm_make_all_cpus_request(),
which is only consumed in calls to smp_call_function_many.  When the
kernel is compiled with CONFIG_SMP=n, smp_call_function_many() turns
into a macro which doesn't use the 'wait' argument, leading to a
warning about the variable 'wait' being unused:

/home/paulus/kernel/kvm/arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function ‘kvm_make_all_cpus_request’:
/home/paulus/kernel/kvm/arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:195:7: error: unused variable ‘wait’ [-Werror=unused-variable]
  bool wait = req & KVM_REQUEST_WAIT;
       ^

Since PPC compiles everything that gets built under arch/powerpc
with -Werror by default, this causes the build to fail.

This fixes it by adding a __maybe_unused annotation to the
declaration of 'wait'.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f0fe9d0..f72b8a0 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -192,7 +192,7 @@  bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
 	int i, cpu, me;
 	cpumask_var_t cpus;
 	bool called = true;
-	bool wait = req & KVM_REQUEST_WAIT;
+	bool __maybe_unused wait = req & KVM_REQUEST_WAIT;
 	struct kvm_vcpu *vcpu;
 
 	zalloc_cpumask_var(&cpus, GFP_ATOMIC);