Commit 69e0ad37 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Peter Zijlstra

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: 9183c3f9 ("static_call: Add inline static call infrastructure")
Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/lkml/20200903203053.3411268-17-samitolvanen@google.com/
parent 547305a6
...@@ -136,7 +136,7 @@ extern void arch_static_call_transform(void *site, void *tramp, void *func, bool ...@@ -136,7 +136,7 @@ extern void arch_static_call_transform(void *site, void *tramp, void *func, bool
#ifdef CONFIG_HAVE_STATIC_CALL_INLINE #ifdef CONFIG_HAVE_STATIC_CALL_INLINE
extern void __init static_call_init(void); extern int __init static_call_init(void);
struct static_call_mod { struct static_call_mod {
struct static_call_mod *next; struct static_call_mod *next;
...@@ -187,7 +187,7 @@ extern int static_call_text_reserved(void *start, void *end); ...@@ -187,7 +187,7 @@ extern int static_call_text_reserved(void *start, void *end);
#elif defined(CONFIG_HAVE_STATIC_CALL) #elif defined(CONFIG_HAVE_STATIC_CALL)
static inline void static_call_init(void) { } static inline int static_call_init(void) { return 0; }
struct static_call_key { struct static_call_key {
void *func; void *func;
...@@ -234,7 +234,7 @@ static inline int static_call_text_reserved(void *start, void *end) ...@@ -234,7 +234,7 @@ static inline int static_call_text_reserved(void *start, void *end)
#else /* Generic implementation */ #else /* Generic implementation */
static inline void static_call_init(void) { } static inline int static_call_init(void) { return 0; }
struct static_call_key { struct static_call_key {
void *func; void *func;
......
...@@ -410,12 +410,12 @@ int static_call_text_reserved(void *start, void *end) ...@@ -410,12 +410,12 @@ int static_call_text_reserved(void *start, void *end)
return __static_call_mod_text_reserved(start, end); return __static_call_mod_text_reserved(start, end);
} }
void __init static_call_init(void) int __init static_call_init(void)
{ {
int ret; int ret;
if (static_call_initialized) if (static_call_initialized)
return; return 0;
cpus_read_lock(); cpus_read_lock();
static_call_lock(); static_call_lock();
...@@ -434,6 +434,7 @@ void __init static_call_init(void) ...@@ -434,6 +434,7 @@ void __init static_call_init(void)
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
register_module_notifier(&static_call_module_nb); register_module_notifier(&static_call_module_nb);
#endif #endif
return 0;
} }
early_initcall(static_call_init); early_initcall(static_call_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment