Skip to content

Commit 69e0ad3

Browse files
nathanchancePeter Zijlstra
authored andcommitted
static_call: Fix return type of static_call_init
Functions that are passed to early_initcall should be of type initcall_t, which expects a return type of int. This is not currently an error but a patch in the Clang LTO series could change that in the future. Fixes: 9183c3f ("static_call: Add inline static call infrastructure") Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Link: https://lore.kernel.org/lkml/20200903203053.3411268-17-samitolvanen@google.com/
1 parent 547305a commit 69e0ad3

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

include/linux/static_call.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extern void arch_static_call_transform(void *site, void *tramp, void *func, bool
136136

137137
#ifdef CONFIG_HAVE_STATIC_CALL_INLINE
138138

139-
extern void __init static_call_init(void);
139+
extern int __init static_call_init(void);
140140

141141
struct static_call_mod {
142142
struct static_call_mod *next;
@@ -187,7 +187,7 @@ extern int static_call_text_reserved(void *start, void *end);
187187

188188
#elif defined(CONFIG_HAVE_STATIC_CALL)
189189

190-
static inline void static_call_init(void) { }
190+
static inline int static_call_init(void) { return 0; }
191191

192192
struct static_call_key {
193193
void *func;
@@ -234,7 +234,7 @@ static inline int static_call_text_reserved(void *start, void *end)
234234

235235
#else /* Generic implementation */
236236

237-
static inline void static_call_init(void) { }
237+
static inline int static_call_init(void) { return 0; }
238238

239239
struct static_call_key {
240240
void *func;

kernel/static_call.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,12 @@ int static_call_text_reserved(void *start, void *end)
410410
return __static_call_mod_text_reserved(start, end);
411411
}
412412

413-
void __init static_call_init(void)
413+
int __init static_call_init(void)
414414
{
415415
int ret;
416416

417417
if (static_call_initialized)
418-
return;
418+
return 0;
419419

420420
cpus_read_lock();
421421
static_call_lock();
@@ -434,6 +434,7 @@ void __init static_call_init(void)
434434
#ifdef CONFIG_MODULES
435435
register_module_notifier(&static_call_module_nb);
436436
#endif
437+
return 0;
437438
}
438439
early_initcall(static_call_init);
439440

0 commit comments

Comments
 (0)