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: 9720881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CA19B60364 for ; Thu, 11 May 2017 03:40:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8EE02867D for ; Thu, 11 May 2017 03:40:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC2152867C; Thu, 11 May 2017 03:40:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F4742865C for ; Thu, 11 May 2017 03:40:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752894AbdEKDkW (ORCPT ); Wed, 10 May 2017 23:40:22 -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-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);