Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3123834pxf; Sun, 21 Mar 2021 20:19:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQw93rZAO8cFR/Q60vZr3bKdwIUV/rw02UY8ladODqJpLCCbFnbhhl8iM9Tsjb9yG6nggj X-Received: by 2002:a17:906:ca50:: with SMTP id jx16mr17176977ejb.72.1616383159582; Sun, 21 Mar 2021 20:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616383159; cv=none; d=google.com; s=arc-20160816; b=DXYa4x7Lw2EvRmtnxxuQzfg7pv5EmDAvarrk6h0g2ONn9zM2KxyFFBCJ+53mfPvKo3 pWqbVXdXiuVMQxesphXlv12d0Qy47mi3lPnr8i48odxeyWEpQwmYJFLhKPzo889V8/aY JWrmuXa2e57+eFALZdCqaVmI1ohM4qwxLkt6ECaDil+P/UpOVqmuuZXXtcufkrCqG5q1 +b17H73Xdq8gejV4Az7WWXLh7RBAAJCq7mbUWp7uIewXJBF0Zzvq2hUEMpU8I4KehjaA WC6FFe4jhxbyDC6D00p4EoZhP7QIFZJpEhth6+ZAxPxQQwM5vNWxGJloPPHJK/5CFhjX h8KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=TbzeZTLU9OGd7GNwvbctVoPmtAdxd1sbcSFjC73FCls=; b=OM1c7TG4AFsqGO6YJOzHKhneUPdbCGTY6sASR3/2P+3+mL6OMsHlxuBVEiRMIjhR7x NdWgnrN9Y8T8IR9mKaSTQM00rsUiRgiIuGa188+ASp21L1Fc4LazC/IO74QnACZo1uQk v6FkcUp0Y4heuedtxWvgQTLKJg8waVjHoLzqdRyJfGKqgwo1ZmfHJTq6LVExmlftkLLS hPcsvonjkk11PjUNH8c4Kx3sJWRfvFBW56/o0GwjiEHsMyJLoR09t5ybeyMaRik1lyEN 3hchNDDLmteCnwZcdz1NeE7W1KWCM1sP4uinQc1M6UlBgEiF5EJ8CQdTg6RDWrSC3CvB vWdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w26si9254077ejn.699.2021.03.21.20.18.57; Sun, 21 Mar 2021 20:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbhCVDRt (ORCPT + 99 others); Sun, 21 Mar 2021 23:17:49 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:14415 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbhCVDRa (ORCPT ); Sun, 21 Mar 2021 23:17:30 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4F3flX3hMlzkd7Y; Mon, 22 Mar 2021 11:15:52 +0800 (CST) Received: from vm-Yoda-Ubuntu1804.huawei.com (10.67.174.59) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Mon, 22 Mar 2021 11:17:20 +0800 From: Xu Yihang To: , , , , , , CC: , , , , Subject: [PATCH -next] x86: Fix unused variable 'msr_val' warning Date: Mon, 22 Mar 2021 11:17:13 +0800 Message-ID: <20210322031713.23853-1-xuyihang@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.174.59] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes the following W=1 kernel build warning(s): arch/x86/hyperv/hv_spinlock.c:28:16: warning: variable ‘msr_val’ set but not used [-Wunused-but-set-variable] unsigned long msr_val; As Hypervisor Top-Level Functional Specification states in chapter 7.5 Virtual Processor Idle Sleep State, "A partition which possesses the AccessGuestIdleMsr privilege (refer to section 4.2.2) may trigger entry into the virtual processor idle sleep state through a read to the hypervisor-defined MSR HV_X64_MSR_GUEST_IDLE". That means only a read is necessary, msr_val is not uesed, so __maybe_unused should be added. Reference: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs Reported-by: Hulk Robot Signed-off-by: Xu Yihang --- arch/x86/hyperv/hv_spinlock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/hyperv/hv_spinlock.c b/arch/x86/hyperv/hv_spinlock.c index f3270c1fc48c..67bc15c7752a 100644 --- a/arch/x86/hyperv/hv_spinlock.c +++ b/arch/x86/hyperv/hv_spinlock.c @@ -25,7 +25,7 @@ static void hv_qlock_kick(int cpu) static void hv_qlock_wait(u8 *byte, u8 val) { - unsigned long msr_val; + unsigned long msr_val __maybe_unused; unsigned long flags; if (in_nmi()) -- 2.17.1