@@ -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;
}
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.schulz@free-electrons.com> --- env/env.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)