This patch is fixing things that most likely will be done by Maxime in
the v2 of his patch series for multiple environments support, one way or
the other.

Signed-off-by: Quentin Schulz <quentin.sch...@free-electrons.com>
---
 env/env.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/env/env.c b/env/env.c
index 9b8b38c..5e70ddf 100644
--- a/env/env.c
+++ b/env/env.c
@@ -182,24 +182,25 @@ int env_init(void)
        struct env_driver *drv;
        int ret = -ENOENT;
        int prio;
+       bool init = false;
 
        for (prio = 0; (drv = env_driver_lookup(ENVO_INIT, prio)); prio++) {
-               if (!drv->init || !drv->init())
+               if (drv->init)
+                       ret = drv->init(drv);
+               else
+                       ret = 0;
+
+               if (!ret) {
                        gd->env_has_init |= BIT(drv->location);
+                       init = true;
+               }
 
                debug("%s: Environment %s init done (ret=%d)\n", __func__,
                      drv->name, ret);
        }
 
-       if (!prio)
+       if (!prio || !init)
                return -ENODEV;
 
-       if (ret == -ENOENT) {
-               gd->env_addr = (ulong)&default_environment[0];
-               gd->env_valid = ENV_VALID;
-
-               return 0;
-       }
-
-       return ret;
+       return 0;
 }
-- 
git-series 0.9.1
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to