[U-Boot] [PATCH] env: sf: fix return value of env_sf_load
Simon Goldschmidt
sgoldschmidt at de.pepperl-fuchs.com
Tue Jan 30 07:55:11 UTC 2018
With the recent changes to support multiple environments, I see a
message "Failed (1)" when loading environment from sf.
env_sf_load() returns the return value of env_import(). This must be
'inverted' to return the correct meaning.
Signed-off-by: Simon Goldschmidt <sgoldschmidt at de.pepperl-fuchs.com>
---
env/sf.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/env/sf.c b/env/sf.c
index a2e4c93631..921860fd88 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -239,6 +239,9 @@ static int env_sf_load(void)
if (!ret) {
pr_err("Cannot import environment: errno = %d\n", errno);
set_default_env("!env_import failed");
+ ret = -EIO;
+ } else {
+ ret = 0;
}
err_read:
@@ -336,8 +339,12 @@ static int env_sf_load(void)
}
ret = env_import(buf, 1);
- if (ret)
+ if (ret) {
gd->env_valid = ENV_VALID;
+ ret = 0;
+ } else {
+ ret = -EIO;
+ }
err_read:
spi_flash_free(env_flash);
--
2.11.0
More information about the U-Boot
mailing list