Skip to contentSkip to conversation

x86/unwind/orc: fix unused function warnings

PATCH In review Arnd Bergmann 2 participants 2 messages Apr 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/unwind/orc: fix unused function warnings

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")
---
 arch/x86/kernel/unwind_orc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/unwind_orc.c +2 -2
index 0ebc11a8bb45..ea8f2aba663f 100644
@@ -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)
 {
Signature · 1 line
2.26.0
#1 lore raw
Quoted 9 lines · Arnd Bergmann

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;
      |             ^~~~~~~~~~~~~~~~
Quoted 4 lines

Move them into the #ifdef section.

Fixes 153eb2223c79 ("x86/unwind/orc: Convert global variables to static")

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

Quoted 29 lines
---
 arch/x86/kernel/unwind_orc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/unwind_orc.c +2 -2
index 0ebc11a8bb45..ea8f2aba663f 100644
@@ -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)
 {
Signature · 1 line
2.26.0
Signature · 1 line
Josh