static enum env_location env_get_default_location(void)
{
- if IS_ENABLED(CONFIG_ENV_IS_IN_DATAFLASH)
- return ENVL_DATAFLASH;
- else if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM)
+ if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM)
return ENVL_EEPROM;
else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT)
return ENVL_FAT;
struct env_driver *drv = env_driver_lookup_default();
int ret;
- if (!gd->env_valid)
+ if (gd->env_valid == ENV_INVALID)
return default_environment[index];
if (!drv)
return -ENODEV;
return -ENODEV;
if (!drv->load)
return 0;
- drv->load(); /* TODO(sjg@chromium.org): Make this return an error */
+ ret = drv->load();
if (ret) {
debug("%s: Environment failed to load (err=%d)\n", __func__,
ret);
ret = drv->init();
if (ret == -ENOENT) {
gd->env_addr = (ulong)&default_environment[0];
- gd->env_valid = 0;
+ gd->env_valid = ENV_VALID;
return 0;
} else if (ret) {
return 0;
}
-
-int saveenv(void)
-{
- return env_save();
-}
-