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>
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
off, (uchar *)buf_env, CONFIG_ENV_SIZE);
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)
}
static int env_eeprom_save(void)
- env_import(buf, 1);
- return 0;
+ return env_import(buf, 1);
err_env_relocate:
set_default_env(NULL);
err_env_relocate:
set_default_env(NULL);
- env_import(buf, 1);
- return 0;
+ return env_import(buf, 1);
err_env_relocate:
set_default_env(NULL);
err_env_relocate:
set_default_env(NULL);
"reading environment; recovered successfully\n\n");
#endif /* CONFIG_ENV_ADDR_REDUND */
"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);
- env_import(buf, 1);
- ret = 0;
+ ret = env_import(buf, 1);
fini:
fini_mmc_for_env(mmc);
fini:
fini_mmc_for_env(mmc);
+ return env_import(buf, 1);
#endif /* ! ENV_IS_EMBEDDED */
return 0;
#endif /* ! ENV_IS_EMBEDDED */
return 0;
#else
memcpy(buf, (void *)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
#endif
#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)
}
static int env_nvram_save(void)
static int env_remote_load(void)
{
#ifndef ENV_IS_EMBEDDED
static int env_remote_load(void)
{
#ifndef ENV_IS_EMBEDDED
- env_import((char *)env_ptr, 1);
+ return env_import((char *)env_ptr, 1);
- env_import(buf, 1);
-
- return 0;
+ return env_import(buf, 1);
}
U_BOOT_ENV_LOCATION(sata) = {
}
U_BOOT_ENV_LOCATION(sata) = {
- env_import(buf, 1);
-
- return 0;
+ return env_import(buf, 1);
}
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
}
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */