linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/bug: Fix build error
@ 2017-11-03 13:47 Julien Thierry
  0 siblings, 0 replies; only message in thread
From: Julien Thierry @ 2017-11-03 13:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Julien Thierry

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 <julien.thierry@arm.com>
Cc: linux-kernel@vger.kernel.org
---
 lib/bug.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/lib/bug.c b/lib/bug.c
index fa9c901..54c1a9b 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-03 13:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 13:47 [PATCH] lib/bug: Fix build error Julien Thierry

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