[PATCH 07/10] startup: Use IS_ENABLED for loading environment

Sascha Hauer s.hauer at pengutronix.de
Sun Jan 20 10:35:16 EST 2013


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/startup.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index 6513ba5..c26bc5f 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");
-- 
1.7.10.4




More information about the barebox mailing list