linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 RESEND] kexec: fix warnig of crash_zero_bytes in crash.c
@ 2019-06-24  4:41 Tiezhu Yang
  2019-06-26 14:07 ` [tip:x86/cleanups] x86/kexec: Make variable static and config dependent tip-bot for Tiezhu Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2019-06-24  4:41 UTC (permalink / raw)
  To: tglx, mingo, bp, hpa; +Cc: x86, linux-kernel, kexec, vgoyal

Fix the following sparse warning:

arch/x86/kernel/crash.c:59:15:
warning: symbol 'crash_zero_bytes' was not declared. Should it be static?

First, make crash_zero_bytes static. In addition, crash_zero_bytes
is used when CONFIG_KEXEC_FILE is set, so make it only available
under CONFIG_KEXEC_FILE. Otherwise, if CONFIG_KEXEC_FILE is not set,
the following warning will appear when make crash_zero_bytes static:

arch/x86/kernel/crash.c:59:22:
warning: ‘crash_zero_bytes’ defined but not used [-Wunused-variable]

Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")
Signed-off-by: Tiezhu Yang <kernelpatch@126.com>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: kexec@lists.infradead.org
---
 arch/x86/kernel/crash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 576b2e1..f13480e 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -56,7 +56,9 @@ struct crash_memmap_data {
  */
 crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss = NULL;
 EXPORT_SYMBOL_GPL(crash_vmclear_loaded_vmcss);
-unsigned long crash_zero_bytes;
+#ifdef CONFIG_KEXEC_FILE
+static unsigned long crash_zero_bytes;
+#endif
 
 static inline void cpu_crash_vmclear_loaded_vmcss(void)
 {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:x86/cleanups] x86/kexec: Make variable static and config dependent
  2019-06-24  4:41 [PATCH v2 RESEND] kexec: fix warnig of crash_zero_bytes in crash.c Tiezhu Yang
@ 2019-06-26 14:07 ` tip-bot for Tiezhu Yang
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Tiezhu Yang @ 2019-06-26 14:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, tglx, dyoung, kernelpatch, vgoyal, linux-kernel, hpa

Commit-ID:  53b7607382b0b99d6ae1ef5b1b0fa042b00ac7f4
Gitweb:     https://git.kernel.org/tip/53b7607382b0b99d6ae1ef5b1b0fa042b00ac7f4
Author:     Tiezhu Yang <kernelpatch@126.com>
AuthorDate: Mon, 24 Jun 2019 12:41:18 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 26 Jun 2019 16:02:45 +0200

x86/kexec: Make variable static and config dependent

The following sparse warning is emitted:

  arch/x86/kernel/crash.c:59:15:
  warning: symbol 'crash_zero_bytes' was not declared. Should it be static?

The variable is only used in this compilation unit, but it is also only
used when CONFIG_KEXEC_FILE is enabled. Just making it static would result
in a 'defined but not used' warning for CONFIG_KEXEC_FILE=n.

Make it static and move it into the existing CONFIG_KEXEC_FILE section.

[ tglx: Massaged changelog and moved it into the existing ifdef ]

Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")
Signed-off-by: Tiezhu Yang <kernelpatch@126.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: bp@alien8.de
Cc: hpa@zytor.com
Cc: kexec@lists.infradead.org
Cc: vgoyal@redhat.com
Cc: Vivek Goyal <vgoyal@redhat.com>
Link: https://lkml.kernel.org/r/117ef0c6.3d30.16b87c9cfbf.Coremail.kernelpatch@126.com
---
 arch/x86/kernel/crash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 576b2e1bfc12..27157d66f807 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -56,7 +56,6 @@ struct crash_memmap_data {
  */
 crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss = NULL;
 EXPORT_SYMBOL_GPL(crash_vmclear_loaded_vmcss);
-unsigned long crash_zero_bytes;
 
 static inline void cpu_crash_vmclear_loaded_vmcss(void)
 {
@@ -181,6 +180,9 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
 }
 
 #ifdef CONFIG_KEXEC_FILE
+
+static unsigned long crash_zero_bytes;
+
 static int get_nr_ram_ranges_callback(struct resource *res, void *arg)
 {
 	unsigned int *nr_ranges = arg;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-26 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24  4:41 [PATCH v2 RESEND] kexec: fix warnig of crash_zero_bytes in crash.c Tiezhu Yang
2019-06-26 14:07 ` [tip:x86/cleanups] x86/kexec: Make variable static and config dependent tip-bot for Tiezhu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).