From c5951991942330c129f3b181e94969d7c01e9abb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 3 Aug 2017 12:22:17 -0600 Subject: env: Adjust the load() method to return an error The load() methods have inconsistent behaviour on error. Some of them load an empty default environment. Some load an environment containing an error message. Others do nothing. As a step in the right direction, have the method return an error code. Then the caller could handle this itself in a consistent way. Signed-off-by: Simon Glass --- env/fat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'env/fat.c') diff --git a/env/fat.c b/env/fat.c index a5a156c88b..ec49c39053 100644 --- a/env/fat.c +++ b/env/fat.c @@ -74,7 +74,7 @@ static int env_fat_save(void) #endif /* CMD_SAVEENV */ #ifdef LOADENV -static void env_fat_load(void) +static int env_fat_load(void) { ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); struct blk_desc *dev_desc = NULL; @@ -103,10 +103,12 @@ static void env_fat_load(void) } env_import(buf, 1); - return; + return 0; err_env_relocate: set_default_env(NULL); + + return -EIO; } #endif /* LOADENV */ -- cgit