mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 03:15:00 +00:00
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>
This commit is contained in:
parent
31f044bd91
commit
2166ebf783
10 changed files with 10 additions and 23 deletions
4
env/eeprom.c
vendored
4
env/eeprom.c
vendored
|
@ -181,9 +181,7 @@ static int env_eeprom_load(void)
|
||||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||||
off, (uchar *)buf_env, CONFIG_ENV_SIZE);
|
off, (uchar *)buf_env, CONFIG_ENV_SIZE);
|
||||||
|
|
||||||
env_import(buf_env, 1);
|
return env_import(buf_env, 1);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int env_eeprom_save(void)
|
static int env_eeprom_save(void)
|
||||||
|
|
3
env/ext4.c
vendored
3
env/ext4.c
vendored
|
@ -114,8 +114,7 @@ static int env_ext4_load(void)
|
||||||
goto err_env_relocate;
|
goto err_env_relocate;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_import(buf, 1);
|
return env_import(buf, 1);
|
||||||
return 0;
|
|
||||||
|
|
||||||
err_env_relocate:
|
err_env_relocate:
|
||||||
set_default_env(NULL);
|
set_default_env(NULL);
|
||||||
|
|
3
env/fat.c
vendored
3
env/fat.c
vendored
|
@ -117,8 +117,7 @@ static int env_fat_load(void)
|
||||||
goto err_env_relocate;
|
goto err_env_relocate;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_import(buf, 1);
|
return env_import(buf, 1);
|
||||||
return 0;
|
|
||||||
|
|
||||||
err_env_relocate:
|
err_env_relocate:
|
||||||
set_default_env(NULL);
|
set_default_env(NULL);
|
||||||
|
|
4
env/flash.c
vendored
4
env/flash.c
vendored
|
@ -351,9 +351,7 @@ static int env_flash_load(void)
|
||||||
"reading environment; recovered successfully\n\n");
|
"reading environment; recovered successfully\n\n");
|
||||||
#endif /* CONFIG_ENV_ADDR_REDUND */
|
#endif /* CONFIG_ENV_ADDR_REDUND */
|
||||||
|
|
||||||
env_import((char *)flash_addr, 1);
|
return env_import((char *)flash_addr, 1);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif /* LOADENV */
|
#endif /* LOADENV */
|
||||||
|
|
||||||
|
|
3
env/mmc.c
vendored
3
env/mmc.c
vendored
|
@ -332,8 +332,7 @@ static int env_mmc_load(void)
|
||||||
goto fini;
|
goto fini;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_import(buf, 1);
|
ret = env_import(buf, 1);
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
fini:
|
fini:
|
||||||
fini_mmc_for_env(mmc);
|
fini_mmc_for_env(mmc);
|
||||||
|
|
2
env/nand.c
vendored
2
env/nand.c
vendored
|
@ -378,7 +378,7 @@ static int env_nand_load(void)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_import(buf, 1);
|
return env_import(buf, 1);
|
||||||
#endif /* ! ENV_IS_EMBEDDED */
|
#endif /* ! ENV_IS_EMBEDDED */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
4
env/nvram.c
vendored
4
env/nvram.c
vendored
|
@ -60,9 +60,7 @@ static int env_nvram_load(void)
|
||||||
#else
|
#else
|
||||||
memcpy(buf, (void *)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
|
memcpy(buf, (void *)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
|
||||||
#endif
|
#endif
|
||||||
env_import(buf, 1);
|
return env_import(buf, 1);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int env_nvram_save(void)
|
static int env_nvram_save(void)
|
||||||
|
|
2
env/remote.c
vendored
2
env/remote.c
vendored
|
@ -49,7 +49,7 @@ static int env_remote_save(void)
|
||||||
static int env_remote_load(void)
|
static int env_remote_load(void)
|
||||||
{
|
{
|
||||||
#ifndef ENV_IS_EMBEDDED
|
#ifndef ENV_IS_EMBEDDED
|
||||||
env_import((char *)env_ptr, 1);
|
return env_import((char *)env_ptr, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
4
env/sata.c
vendored
4
env/sata.c
vendored
|
@ -113,9 +113,7 @@ static void env_sata_load(void)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_import(buf, 1);
|
return env_import(buf, 1);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
U_BOOT_ENV_LOCATION(sata) = {
|
U_BOOT_ENV_LOCATION(sata) = {
|
||||||
|
|
4
env/ubi.c
vendored
4
env/ubi.c
vendored
|
@ -163,9 +163,7 @@ static int env_ubi_load(void)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_import(buf, 1);
|
return env_import(buf, 1);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue