]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
env: Load env when ENV_IS_NOWHERE is only location selected
authorFelix.Vietmeyer@jila.colorado.edu <Felix.Vietmeyer@jila.colorado.edu>
Wed, 21 Apr 2021 02:04:26 +0000 (20:04 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 7 Apr 2022 17:52:36 +0000 (13:52 -0400)
This patch prevent u-boot from hanging on a UltraZed EG board (zynqmp).

Without the patch,
(drv = env_driver_lookup(ENVOP_INIT, prio))
evaluates to 0, causing prio = 0
Then, (!prio) is hit, returning -ENODEV causing a stall.

With the patch,
instead of returning -ENODEV and causing a stall, we
set gd->env_addr (is this really needed?)
and then
mark gd->env_valid = ENV_INVALID to use the default env.

env/env.c

index e4dfb92e154057516a7459f8273f875bddec37a5..7168cb9d3184624b20d8e617fa2032f390bbf62b 100644 (file)
--- a/env/env.c
+++ b/env/env.c
@@ -322,17 +322,18 @@ int env_init(void)
 
                debug("%s: Environment %s init done (ret=%d)\n", __func__,
                      drv->name, ret);
-
-               if (gd->env_valid == ENV_INVALID)
-                       ret = -ENOENT;
        }
 
-       if (!prio)
-               return -ENODEV;
+       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_VALID;
+               gd->env_valid = ENV_INVALID;
 
                return 0;
        }