mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julien Thierry <julien.thierry@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Julien Thierry <julien.thierry@arm.com>
Subject: [PATCH] lib/bug: Fix build error
Date: Fri,  3 Nov 2017 13:47:53 +0000	[thread overview]
Message-ID: <1509716873-46403-1-git-send-email-julien.thierry@arm.com> (raw)

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

                 reply	other threads:[~2017-11-03 13:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509716873-46403-1-git-send-email-julien.thierry@arm.com \
    --to=julien.thierry@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®