[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MWHPR21MB1593B76BB230F7905328DFE4D7689@MWHPR21MB1593.namprd21.prod.outlook.com>
Date: Fri, 19 Mar 2021 18:58:09 +0000
From: Michael Kelley <mikelley@...rosoft.com>
To: Ingo Molnar <mingo@...nel.org>, Xu Yihang <xuyihang@...wei.com>
CC: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "x86@...nel.org" <x86@...nel.org>,
"hpa@...or.com" <hpa@...or.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH -next] x86: Fix unused variable 'hi'
From: Ingo Molnar <mingo.kernel.org@...il.com> Sent: Thursday, March 18, 2021 4:24 AM
>
> * Xu Yihang <xuyihang@...wei.com> wrote:
>
> > Fixes the following W=1 kernel build warning(s):
> > arch/x86/hyperv/hv_apic.c:58:15: warning: variable ‘hi’ set but not used [-Wunused-but-
> set-variable]
> >
> > Reported-by: Hulk Robot <hulkci@...wei.com>
> > Signed-off-by: Xu Yihang <xuyihang@...wei.com>
> > ---
> > arch/x86/hyperv/hv_apic.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
> > index 284e73661a18..c0b0a5774f31 100644
> > --- a/arch/x86/hyperv/hv_apic.c
> > +++ b/arch/x86/hyperv/hv_apic.c
> > @@ -55,7 +55,8 @@ static void hv_apic_icr_write(u32 low, u32 id)
> >
> > static u32 hv_apic_read(u32 reg)
> > {
> > - u32 reg_val, hi;
> > + u32 hi __maybe_unused;
> > + u32 reg_val;
> >
> > switch (reg) {
> > case APIC_EOI:
>
> Why and under what config does this function trigger the warning?
>
> Thanks,
>
> Ingo
The warning should trigger if CONFIG_HYPERV is "m" or "y", and W=1
is selected. The variable is indeed set but not used because only the
low order 32 bits of the synthetic MSR are relevant, but rdmsr() returns
both the low 32 and the high 32 bits.
Michael
Powered by blists - more mailing lists