U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] env: Load env when ENV_IS_NOWHERE is only location selected
@ 2021-04-21  2:04 Felix.Vietmeyer at jila.colorado.edu
  2022-04-08 12:30 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Felix.Vietmeyer at jila.colorado.edu @ 2021-04-21  2:04 UTC (permalink / raw)
  To: u-boot

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 | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/env/env.c b/env/env.c
index e534008006..44a65ab216 100644
--- a/env/env.c
+++ b/env/env.c
@@ -335,17 +335,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;
 	}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-08 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-21  2:04 [PATCH] env: Load env when ENV_IS_NOWHERE is only location selected Felix.Vietmeyer at jila.colorado.edu
2022-04-08 12:30 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox