summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2022-04-10 06:46:52 +0200
committerTom Rini <trini@konsulko.com>2022-04-10 11:20:16 -0400
commit5c7399ec90513bc0310801c9f852ea7697a91759 (patch)
treede1c05d2aa1b8058fdb84b5d1134b5e62370a92a /env
parent22b7d140fa17a15e85b87cd7258fa4ff190a11a3 (diff)
Revert "env: Load env when ENV_IS_NOWHERE is only location selected"
This reverts commit 8d61237edbf6314a701cf78da2c5893a73ff5438. This commit broke environment on literally every board I have access to, with this revert in place, environment works as it should again. The problem I observe with this patch is that saved environment in either SPI NOR or eMMC is never used, the system always falls back to default environment. The 'saveenv' command does succeed, but then after reset, the default env is again used. Furthermore, the commit introduced duplicate code in env_init(), this: " if (!prio) { gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = ENV_INVALID; return 0; } if (ret == -ENOENT) { gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = ENV_INVALID; return 0; } " Furthermore, the commit is missing DCO SoB line. Also note that upstream does not support UltraZed EG board, so this might have been a patch pulled from downstream which did depend on some other downstream behavior. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Felix.Vietmeyer@jila.colorado.edu <felix.vietmeyer@jila.colorado.edu> Cc: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'env')
-rw-r--r--env/env.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/env/env.c b/env/env.c
index 7168cb9d31..e4dfb92e15 100644
--- a/env/env.c
+++ b/env/env.c
@@ -322,18 +322,17 @@ int env_init(void)
debug("%s: Environment %s init done (ret=%d)\n", __func__,
drv->name, ret);
- }
-
- if (!prio) {
- gd->env_addr = (ulong)&default_environment[0];
- gd->env_valid = ENV_INVALID;
- return 0;
+ if (gd->env_valid == ENV_INVALID)
+ ret = -ENOENT;
}
+ if (!prio)
+ return -ENODEV;
+
if (ret == -ENOENT) {
gd->env_addr = (ulong)&default_environment[0];
- gd->env_valid = ENV_INVALID;
+ gd->env_valid = ENV_VALID;
return 0;
}