env: sf: fix return value of env_sf_load
PATCH 1/1 env: sf: fix return value of env_sf_load
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.
--- env/sf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
env/sf.c +8 -1
@@ -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);
Signature · 1 line
2.11.0
PATCH 1/1 env: sf: fix return value of env_sf_load
Quoted 5 lines · Simon Goldschmidt
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 ofenv_import(). This must be 'inverted' to return the correct meaning.
Thinking about this again, it might be cleaner to make env_import and env_import_redundant return 0 on success. Would that be acceptable?
Regards,
Simon
Quoted 34 lines
Signed-off-by Simon Goldschmidt <[email protected]>--- env/sf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)env/sf.c +8
-1@@ -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);
PATCH 1/1 env: sf: fix return value of env_sf_load
Quoted 9 lines · Simon Goldschmidt
Quoted 5 lines · Simon Goldschmidt
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 ofenv_import(). This must be 'inverted' to return the correct meaning.Thinking about this again, it might be cleaner to make
env_importandenv_import_redundantreturn 0 on success. Would that be acceptable?
If it makes things look cleaner, yes, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180130/0a6b0b62/attachment.sig>