summaryrefslogtreecommitdiff
path: root/env/onenand.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-08-03 12:22:17 -0600
committerTom Rini <trini@konsulko.com>2017-08-16 08:31:24 -0400
commitc5951991942330c129f3b181e94969d7c01e9abb (patch)
tree39b5ee4ee37e5a595e088456e792d7251f7ee1ca /env/onenand.c
parent21f639446d6bccb6cc550140d36bd3ebd74fcee8 (diff)
downloadu-boot-c5951991942330c129f3b181e94969d7c01e9abb.tar.gz
u-boot-c5951991942330c129f3b181e94969d7c01e9abb.tar.bz2
u-boot-c5951991942330c129f3b181e94969d7c01e9abb.zip
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 <sjg@chromium.org>
Diffstat (limited to 'env/onenand.c')
-rw-r--r--env/onenand.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/env/onenand.c b/env/onenand.c
index 319f553262..2e3045c5f5 100644
--- a/env/onenand.c
+++ b/env/onenand.c
@@ -26,7 +26,7 @@
DECLARE_GLOBAL_DATA_PTR;
-static void env_onenand_load(void)
+static int env_onenand_load(void)
{
struct mtd_info *mtd = &onenand_mtd;
#ifdef CONFIG_ENV_ADDR_FLEX
@@ -59,6 +59,8 @@ static void env_onenand_load(void)
rc = env_import(buf, 1);
if (rc)
gd->env_valid = ENV_VALID;
+
+ return rc ? 0 : -EIO;
}
static int env_onenand_save(void)