From 7ed52f887036fb0f4c1c4ccb38b72fd766082410 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 20 Jan 2013 13:30:17 +0100 Subject: startup: Use IS_ENABLED for loading environment Signed-off-by: Sascha Hauer --- common/startup.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'common/startup.c') diff --git a/common/startup.c b/common/startup.c index 6513ba536a..c26bc5f225 100644 --- a/common/startup.c +++ b/common/startup.c @@ -110,16 +110,18 @@ void start_barebox (void) debug("initcalls done\n"); -#ifdef CONFIG_ENV_HANDLING - if (envfs_load(default_environment_path, "/env", 0)) { -#ifdef CONFIG_DEFAULT_ENVIRONMENT - printf("no valid environment found on %s. " - "Using default environment\n", - default_environment_path); - envfs_load("/dev/defaultenv", "/env", 0); -#endif + if (IS_ENABLED(CONFIG_ENV_HANDLING)) { + int ret; + + ret = envfs_load(default_environment_path, "/env", 0); + + if (ret && IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) { + printf("no valid environment found on %s. " + "Using default environment\n", + default_environment_path); + envfs_load("/dev/defaultenv", "/env", 0); + } } -#endif if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) { printf("running /env/bin/init...\n"); -- cgit v1.2.3