lib/bug: Fix build error
PATCH 1/1 lib/bug: Fix build error
Generic bug management code handle a table of bugs per module. When kernel is built without CONFIG_MODULES, the module_bug_list is compiled out, yet generic_bug_clear_once tries to reference it, causing an error.
Introduce helper function to avoid the reference to module_bug_list when it is not defined.
Signed-off-by Julien Thierry <[email protected]>
--- lib/bug.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
lib/bug.c +18 -8
@@ -50,6 +50,8 @@extern struct bug_entry __start___bug_table[], __stop___bug_table[]; +static void clear_once_table (struct bug_entry *start,struct bug_entry *end); +static inline unsigned long bug_addr (const struct bug_entry *bug) {#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
@@ -121,8 +123,23 @@ void module_bug_cleanup(struct module *mod) list_del_rcu(&mod->bug_list); } +static void module_bug_clear_once (void ) +{ +struct module *mod; + +rcu_read_lock_sched (); +list_for_each_entry_rcu (mod, &module_bug_list, bug_list) +clear_once_table (mod->bug_table, + mod->bug_table + mod->num_bugs); +rcu_read_unlock_sched (); +} +#else +static inline void module_bug_clear_once (void ) +{ +} +static inline struct bug_entry *module_find_bug (unsigned long bugaddr) {return NULL ;
@@ -207,13 +224,6 @@ static void clear_once_table(struct bug_entry *start, struct bug_entry *end)void generic_bug_clear_once (void ) { -struct module *mod; - -rcu_read_lock_sched (); -list_for_each_entry_rcu (mod, &module_bug_list, bug_list) -clear_once_table (mod->bug_table, - mod->bug_table + mod->num_bugs); -rcu_read_unlock_sched (); - +module_bug_clear_once ();clear_once_table (__start___bug_table, __stop___bug_table); }
--
1.9.1