From patchwork Thu May 11 03:40:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Mackerras X-Patchwork-Id: 760921 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wNf536tFyz9s8V for ; Thu, 11 May 2017 13:40:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbdEKDkV (ORCPT ); Wed, 10 May 2017 23:40:21 -0400 Received: from ozlabs.org ([103.22.144.67]:35955 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751096AbdEKDkU (ORCPT ); Wed, 10 May 2017 23:40:20 -0400 Received: by ozlabs.org (Postfix, from userid 1003) id 3wNf4y3zwyz9sCZ; Thu, 11 May 2017 13:40:18 +1000 (AEST) Date: Thu, 11 May 2017 13:40:13 +1000 From: Paul Mackerras To: Paolo Bonzini , kvm@vger.kernel.org Cc: kvm-ppc@vger.kernel.org Subject: [PATCH] KVM: Eliminate unused variable warning on uniprocessor configs Message-ID: <20170511034013.GB14071@fergus.ozlabs.ibm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org 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 --- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);