From: Dave Hansen <dave.hansen@intel.com>
To: Zhenzhong Duan <zhenzhong.duan@gmail.com>, linux-kernel@vger.kernel.org
Cc: x86@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, Borislav Petkov <bp@suse.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH 2/2] x86/boot/KASLR: Fix unused variable warning
Date: Tue, 3 Mar 2020 14:56:47 -0800 [thread overview]
Message-ID: <ba5067ad-4fba-52c9-6872-c18bfeb947db@intel.com> (raw)
In-Reply-To: <20200303065210.1279-3-zhenzhong.duan@gmail.com>
On 3/2/20 10:52 PM, Zhenzhong Duan wrote:
> Local variable 'i' is referenced only when CONFIG_MEMORY_HOTREMOVE and
> CONFIG_ACPI are defined, but definition of variable 'i' is out of guard.
> If any of the two macros is undefined, below warning triggers during
> build, fix it by moving 'i' in the guard.
>
> arch/x86/boot/compressed/kaslr.c:698:6: warning: unused variable ‘i’ [-Wunused-variable]
...
> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> index d7408af55738..62bc46684581 100644
> --- a/arch/x86/boot/compressed/kaslr.c
> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -695,7 +695,6 @@ static bool process_mem_region(struct mem_vector *region,
> unsigned long long minimum,
> unsigned long long image_size)
> {
> - int i;
> /*
> * If no immovable memory found, or MEMORY_HOTREMOVE disabled,
> * use @region directly.
> @@ -711,6 +710,7 @@ static bool process_mem_region(struct mem_vector *region,
> }
>
> #if defined(CONFIG_MEMORY_HOTREMOVE) && defined(CONFIG_ACPI)
> + int i;
Won't this just result in a different warning since it now it will
declare 'i' in the middle of the function once CONFIG_MEMORY_HOTREMOVE
and ACPI are enabled?
next prev parent reply other threads:[~2020-03-03 22:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 6:52 [PATCH 0/2] Add -Wunused to x86 boot module and fix build warning Zhenzhong Duan
2020-03-03 6:52 ` [PATCH 1/2] x86/boot: Add -Wunused to KBUILD_CFLAGS Zhenzhong Duan
2020-03-03 6:52 ` [PATCH 2/2] x86/boot/KASLR: Fix unused variable warning Zhenzhong Duan
2020-03-03 22:56 ` Dave Hansen [this message]
2020-03-05 4:03 ` Zhenzhong Duan
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=ba5067ad-4fba-52c9-6872-c18bfeb947db@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=zhenzhong.duan@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®