Skip to contentSkip to conversation

static_call: fix unused variable warning

PATCH New Carlos Llamas 1 participant 1 message Apr 16, 2021 Static branch/call

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 static_call: fix unused variable warning

'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")
---
 kernel/static_call.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/static_call.c +1 -1
index 2c5950b0b90e..8211a34251f8 100644
@@ -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) {
 			/*
Signature · 1 line
2.31.1.368.gbe11c130af-goog