By initializing barebox_main in start_barebox(), we preclude changing barebox_main before start_barebox() is called. This can be useful, at least in sandbox. Therefore, let's initialize barebox_main statically. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/startup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/common/startup.c b/common/startup.c index 4cb9cfcdaa49..898bef6d22e4 100644 --- a/common/startup.c +++ b/common/startup.c @@ -355,16 +355,15 @@ static void do_ctors(void) #endif } -int (*barebox_main)(void); +int (*barebox_main)(void) + = !IS_ENABLED(CONFIG_SHELL_NONE) && + IS_ENABLED(CONFIG_COMMAND_SUPPORT) ? run_init : NULL; void __noreturn start_barebox(void) { initcall_t *initcall; int result; - if (!IS_ENABLED(CONFIG_SHELL_NONE) && IS_ENABLED(CONFIG_COMMAND_SUPPORT)) - barebox_main = run_init; - do_ctors(); for (initcall = __barebox_initcalls_start; -- 2.39.5