summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
authorSimon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>2018-01-31 14:47:12 +0100
committerTom Rini <trini@konsulko.com>2018-02-01 08:05:53 -0500
commit2166ebf7831674508425daf50c78e481083c6462 (patch)
tree7f872e44844c2ec406737d71a71188368e3be38a /env
parent31f044bd91df58bed6bb8cfadfc187eedac1442e (diff)
env: make env drivers propagate env_import return value
For multiple env drivers to correctly implement fallback when one environment fails to load (e.g. crc error), the return value of env_import has to be propagated by all env driver's load function. Without this change, the first driver that succeeds to load an environment with an invalid CRC return 0 (success) and no other drivers are checked. Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'env')
-rw-r--r--env/eeprom.c4
-rw-r--r--env/ext4.c3
-rw-r--r--env/fat.c3
-rw-r--r--env/flash.c4
-rw-r--r--env/mmc.c3
-rw-r--r--env/nand.c2
-rw-r--r--env/nvram.c4
-rw-r--r--env/remote.c2
-rw-r--r--env/sata.c4
-rw-r--r--env/ubi.c4
10 files changed, 10 insertions, 23 deletions
diff --git a/env/eeprom.c b/env/eeprom.c
index 584379ebd2..55d19d9d99 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -181,9 +181,7 @@ static int env_eeprom_load(void)
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
off, (uchar *)buf_env, CONFIG_ENV_SIZE);
- env_import(buf_env, 1);
-
- return 0;
+ return env_import(buf_env, 1);
}
static int env_eeprom_save(void)
diff --git a/env/ext4.c b/env/ext4.c
index 9cdf28e79f..3f3aac5737 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -114,8 +114,7 @@ static int env_ext4_load(void)
goto err_env_relocate;
}
- env_import(buf, 1);
- return 0;
+ return env_import(buf, 1);
err_env_relocate:
set_default_env(NULL);
diff --git a/env/fat.c b/env/fat.c
index 158a9a3435..35f7ab5c6d 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -117,8 +117,7 @@ static int env_fat_load(void)
goto err_env_relocate;
}
- env_import(buf, 1);
- return 0;
+ return env_import(buf, 1);
err_env_relocate:
set_default_env(NULL);
diff --git a/env/flash.c b/env/flash.c
index bac10ff985..ccade77ce3 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -351,9 +351,7 @@ static int env_flash_load(void)
"reading environment; recovered successfully\n\n");
#endif /* CONFIG_ENV_ADDR_REDUND */
- env_import((char *)flash_addr, 1);
-
- return 0;
+ return env_import((char *)flash_addr, 1);
}
#endif /* LOADENV */
diff --git a/env/mmc.c b/env/mmc.c
index 8847fdc7e2..1058b8c512 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -332,8 +332,7 @@ static int env_mmc_load(void)
goto fini;
}
- env_import(buf, 1);
- ret = 0;
+ ret = env_import(buf, 1);
fini:
fini_mmc_for_env(mmc);
diff --git a/env/nand.c b/env/nand.c
index 3e8df39c26..904f1c40d6 100644
--- a/env/nand.c
+++ b/env/nand.c
@@ -378,7 +378,7 @@ static int env_nand_load(void)
return -EIO;
}
- env_import(buf, 1);
+ return env_import(buf, 1);
#endif /* ! ENV_IS_EMBEDDED */
return 0;
diff --git a/env/nvram.c b/env/nvram.c
index c8b34754ef..6f76fe4b8d 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -60,9 +60,7 @@ static int env_nvram_load(void)
#else
memcpy(buf, (void *)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
#endif
- env_import(buf, 1);
-
- return 0;
+ return env_import(buf, 1);
}
static int env_nvram_save(void)
diff --git a/env/remote.c b/env/remote.c
index c013fdd4b0..379d0eb1bb 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -49,7 +49,7 @@ static int env_remote_save(void)
static int env_remote_load(void)
{
#ifndef ENV_IS_EMBEDDED
- env_import((char *)env_ptr, 1);
+ return env_import((char *)env_ptr, 1);
#endif
return 0;
diff --git a/env/sata.c b/env/sata.c
index a77029774e..4bfe0119df 100644
--- a/env/sata.c
+++ b/env/sata.c
@@ -113,9 +113,7 @@ static void env_sata_load(void)
return -EIO;
}
- env_import(buf, 1);
-
- return 0;
+ return env_import(buf, 1);
}
U_BOOT_ENV_LOCATION(sata) = {
diff --git a/env/ubi.c b/env/ubi.c
index 72c7a7829e..d4f4901ac4 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -163,9 +163,7 @@ static int env_ubi_load(void)
return -EIO;
}
- env_import(buf, 1);
-
- return 0;
+ return env_import(buf, 1);
}
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */