All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] static_call: Fix unused variable warning
@ 2021-04-22  0:33 Guenter Roeck
  2021-04-22  0:41 ` Steven Rostedt
  0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2021-04-22  0:33 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Josh Poimboeuf, Jason Baron, Steven Rostedt, Ard Biesheuvel,
	linux-kernel, Guenter Roeck

If CONFIG_MODULES=n, the following build warning is reported.

kernel/static_call.c: In function ‘__static_call_update’:
kernel/static_call.c:153:18: warning: unused variable ‘mod’

Mark the variable as __maybe_unused to fix the problem.

Fixes: 9183c3f9ed71 ("static_call: Add inline static call infrastructure")
Reported-by: Zach Reizner <zachr@google.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 kernel/static_call.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/static_call.c b/kernel/static_call.c
index 2c5950b0b90e..8211a34251f8 100644
--- a/kernel/static_call.c
+++ b/kernel/static_call.c
@@ -150,7 +150,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func)
 
 	for (site_mod = &first; site_mod; site_mod = site_mod->next) {
 		bool init = system_state < SYSTEM_RUNNING;
-		struct module *mod = site_mod->mod;
+		struct module __maybe_unused *mod = site_mod->mod;
 
 		if (!site_mod->sites) {
 			/*
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH] static_call: fix unused variable warning
@ 2021-04-16 19:43 Carlos Llamas
  0 siblings, 0 replies; 11+ messages in thread
From: Carlos Llamas @ 2021-04-16 19:43 UTC (permalink / raw)
  To: Peter Zijlstra, Josh Poimboeuf, Jason Baron, Steven Rostedt,
	Ard Biesheuvel, Ingo Molnar
  Cc: linux-kernel, Carlos Llamas, kernelci . org bot

'mod' is not used when !CONFIG_MODULES. Mark as __maybe_unused to
fix the following warning:

kernel/static_call.c: In function ‘__static_call_update’:
kernel/static_call.c:153:18: warning: unused variable ‘mod’ [-Wunused-variable]
  153 |   struct module *mod = site_mod->mod;
      |                  ^~~

Fixes: 9183c3f9ed71 ("static_call: Add inline static call infrastructure")
Reported-by: kernelci.org bot <bot@kernelci.org>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
 kernel/static_call.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/static_call.c b/kernel/static_call.c
index 2c5950b0b90e..8211a34251f8 100644
--- a/kernel/static_call.c
+++ b/kernel/static_call.c
@@ -150,7 +150,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func)
 
 	for (site_mod = &first; site_mod; site_mod = site_mod->next) {
 		bool init = system_state < SYSTEM_RUNNING;
-		struct module *mod = site_mod->mod;
+		struct module __maybe_unused *mod = site_mod->mod;
 
 		if (!site_mod->sites) {
 			/*
-- 
2.31.1.368.gbe11c130af-goog


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

end of thread, other threads:[~2021-04-22 18:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22  0:33 [PATCH] static_call: Fix unused variable warning Guenter Roeck
2021-04-22  0:41 ` Steven Rostedt
2021-04-22  1:24   ` Guenter Roeck
2021-04-22  1:33     ` Steven Rostedt
2021-04-22  1:45       ` Guenter Roeck
2021-04-22  2:38         ` Steven Rostedt
2021-04-22  7:20   ` Peter Zijlstra
2021-04-22 14:01     ` Guenter Roeck
2021-04-22 16:13       ` Peter Zijlstra
2021-04-22 18:01         ` Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2021-04-16 19:43 [PATCH] static_call: fix " Carlos Llamas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.