History

static_call: Fix unused variable warn w/o MODULE

Here is the warning converted as error and reported by GCC: kernel/static_call.c: In function ‘__static_call_update’: kernel/static_call.c:153:18: error: unused variable ‘mod’ [-Werror=unused-variable] 153 | struct module *mod = site_mod->mod; | ^~~ cc1: all warnings being treated as errors make[1]: *** [scripts/Makefile.build:271: kernel/static_call.o] Error 1 This is simply because since recently, we no longer use 'mod' variable elsewhere if MODULE is unset. When using 'make tinyconfig' to generate the default kconfig, MODULE is unset. There are different ways to fix this warning. Here I tried to minimised the number of modified lines and not add more #ifdef. We could also move the declaration of the 'mod' variable inside the if-statement or directly use site_mod->mod.

Matthieu Baerts committed 5 years ago

Commit 7d95f221 parent a51a3271 file · +2 −2Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/static_call.c+2−2
@@ -165,13 +165,13 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) · 164 unmodified lines
165165
166166 stop = __stop_static_call_sites;
167167
168−#ifdef CONFIG_MODULES
169168 if (mod) {
169+#ifdef CONFIG_MODULES
170170 stop = mod->static_call_sites +
171171 mod->num_static_call_sites;
172172 init = mod->state == MODULE_STATE_COMING;
173− }
174173 #endif
174+ }
175175
176176 for (site = site_mod->sites;
177177 site < stop && static_call_key(site) == key; site++) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t