linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/unwind/orc: fix unused function warnings
@ 2020-04-28 21:36 Arnd Bergmann
  2020-04-28 21:43 ` Josh Poimboeuf
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-04-28 21:36 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	Josh Poimboeuf, Miroslav Benes
  Cc: Arnd Bergmann, Ingo Molnar, Andy Lutomirski, Dave Jones,
	Jann Horn, Peter Zijlstra, Vince Weaver, H. Peter Anvin,
	Shile Zhang, linux-kernel

Without CONFIG_MODULES, these two variables are unused:

arch/x86/kernel/unwind_orc.c:29:26: error: 'cur_orc_table' defined but not used [-Werror=unused-variable]
   29 | static struct orc_entry *cur_orc_table = __start_orc_unwind;
      |                          ^~~~~~~~~~~~~
arch/x86/kernel/unwind_orc.c:28:13: error: 'cur_orc_ip_table' defined but not used [-Werror=unused-variable]
   28 | static int *cur_orc_ip_table = __start_orc_unwind_ip;
      |             ^~~~~~~~~~~~~~~~

Move them into the #ifdef section.

Fixes: 153eb2223c79 ("x86/unwind/orc: Convert global variables to static")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/kernel/unwind_orc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index 0ebc11a8bb45..ea8f2aba663f 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -25,8 +25,6 @@ static bool orc_init __ro_after_init;
 static unsigned int lookup_num_blocks __ro_after_init;
 
 static DEFINE_MUTEX(sort_mutex);
-static int *cur_orc_ip_table = __start_orc_unwind_ip;
-static struct orc_entry *cur_orc_table = __start_orc_unwind;
 
 static inline unsigned long orc_ip(const int *ip)
 {
@@ -191,6 +189,8 @@ static struct orc_entry *orc_find(unsigned long ip)
 }
 
 #ifdef CONFIG_MODULES
+static int *cur_orc_ip_table = __start_orc_unwind_ip;
+static struct orc_entry *cur_orc_table = __start_orc_unwind;
 
 static void orc_sort_swap(void *_a, void *_b, int size)
 {
-- 
2.26.0


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

* Re: [PATCH] x86/unwind/orc: fix unused function warnings
  2020-04-28 21:36 [PATCH] x86/unwind/orc: fix unused function warnings Arnd Bergmann
@ 2020-04-28 21:43 ` Josh Poimboeuf
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Poimboeuf @ 2020-04-28 21:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	Miroslav Benes, Ingo Molnar, Andy Lutomirski, Dave Jones,
	Jann Horn, Peter Zijlstra, Vince Weaver, H. Peter Anvin,
	Shile Zhang, linux-kernel

On Tue, Apr 28, 2020 at 11:36:09PM +0200, Arnd Bergmann wrote:
> Without CONFIG_MODULES, these two variables are unused:
> 
> arch/x86/kernel/unwind_orc.c:29:26: error: 'cur_orc_table' defined but not used [-Werror=unused-variable]
>    29 | static struct orc_entry *cur_orc_table = __start_orc_unwind;
>       |                          ^~~~~~~~~~~~~
> arch/x86/kernel/unwind_orc.c:28:13: error: 'cur_orc_ip_table' defined but not used [-Werror=unused-variable]
>    28 | static int *cur_orc_ip_table = __start_orc_unwind_ip;
>       |             ^~~~~~~~~~~~~~~~
> 
> Move them into the #ifdef section.
> 
> Fixes: 153eb2223c79 ("x86/unwind/orc: Convert global variables to static")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I posted a similar patch yesterday (I also moved the mutex; not sure why
GCC didn't complain about that one).

https://lkml.kernel.org/r/20200428071640.psn5m7eh3zt2in4v@treble

> ---
>  arch/x86/kernel/unwind_orc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
> index 0ebc11a8bb45..ea8f2aba663f 100644
> --- a/arch/x86/kernel/unwind_orc.c
> +++ b/arch/x86/kernel/unwind_orc.c
> @@ -25,8 +25,6 @@ static bool orc_init __ro_after_init;
>  static unsigned int lookup_num_blocks __ro_after_init;
>  
>  static DEFINE_MUTEX(sort_mutex);
> -static int *cur_orc_ip_table = __start_orc_unwind_ip;
> -static struct orc_entry *cur_orc_table = __start_orc_unwind;
>  
>  static inline unsigned long orc_ip(const int *ip)
>  {
> @@ -191,6 +189,8 @@ static struct orc_entry *orc_find(unsigned long ip)
>  }
>  
>  #ifdef CONFIG_MODULES
> +static int *cur_orc_ip_table = __start_orc_unwind_ip;
> +static struct orc_entry *cur_orc_table = __start_orc_unwind;
>  
>  static void orc_sort_swap(void *_a, void *_b, int size)
>  {
> -- 
> 2.26.0
> 

-- 
Josh


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

end of thread, other threads:[~2020-04-28 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 21:36 [PATCH] x86/unwind/orc: fix unused function warnings Arnd Bergmann
2020-04-28 21:43 ` Josh Poimboeuf

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).