All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xu Yihang <xuyihang@huawei.com>
To: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<x86@kernel.org>, <hpa@zytor.com>, <tony.luck@intel.com>,
	<fenghua.yu@intel.com>, <rppt@kernel.org>, <xiaoyao.li@intel.com>,
	<seanjc@google.com>, <linux-kernel@vger.kernel.org>
Cc: <xuyihang@huawei.com>, <johnny.chenyi@huawei.com>
Subject: [PATCH -next] x86: Fix intel cpu unsed variable ‘l2’ warning
Date: Tue, 23 Mar 2021 10:59:01 +0800	[thread overview]
Message-ID: <20210323025901.205381-1-xuyihang@huawei.com> (raw)

Fixes the following W=1 kernel build warning(s):
../arch/x86/kernel/cpu/intel.c: In function ‘init_intel’:
../arch/x86/kernel/cpu/intel.c:644:20: warning: variable ‘l2’ set but not used [-Wunused-but-set-variable]
   unsigned int l1, l2;
                    ^~

Compilation command(s):
make allmodconfig ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-
make W=1 arch/x86/kernel/cpu/intel.o ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-

According to Intel Software Developer's Manual Table 2-2 through Table 2-24 about MSRs:
X86_FEATURE_BTS which represents Branch Trace Storage Unavailable and X86_FEATURE_PEBS
represens Processor Event Based Sampling (PEBS) Unavailable, but on some platform these fields
maybe reserved or not available. For the function init_intel it self, only bit 11 and bit 12
are used for checking BTS and PEBS, and higher 32 bits are not used. So cast to void to
avoid warning.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Xu Yihang <xuyihang@huawei.com>
---
 arch/x86/kernel/cpu/intel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 63e381a46153..547ba6668eb3 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -644,6 +644,7 @@ static void init_intel(struct cpuinfo_x86 *c)
 		unsigned int l1, l2;
 
 		rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
+		(void) l2;
 		if (!(l1 & (1<<11)))
 			set_cpu_cap(c, X86_FEATURE_BTS);
 		if (!(l1 & (1<<12)))
-- 
2.17.1


             reply	other threads:[~2021-03-23  2:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  2:59 Xu Yihang [this message]
2021-03-23  9:21 ` [PATCH -next] x86: Fix intel cpu unsed variable ‘l2’ warning Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210323025901.205381-1-xuyihang@huawei.com \
    --to=xuyihang@huawei.com \
    --cc=bp@alien8.de \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=johnny.chenyi@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rppt@kernel.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.