[PATCH v2 01/12] env: Don't set ready flag if import failed in env_set_default()

Marek Behún kabel at kernel.org
Thu Nov 4 00:23:21 CET 2021


From: Marek Behún <marek.behun at nic.cz>

Do not set GD_FLG_ENV_READY nor GD_FLG_ENV_DEFAULT if failed importing
in env_set_default().

Signed-off-by: Marek Behún <marek.behun at nic.cz>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
 env/common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/env/common.c b/env/common.c
index 99729ca002..2aa23545ba 100644
--- a/env/common.c
+++ b/env/common.c
@@ -261,9 +261,11 @@ void env_set_default(const char *s, int flags)
 	flags |= H_DEFAULT;
 	if (himport_r(&env_htab, default_environment,
 			sizeof(default_environment), '\0', flags, 0,
-			0, NULL) == 0)
+			0, NULL) == 0) {
 		pr_err("## Error: Environment import failed: errno = %d\n",
 		       errno);
+		return;
+	}
 
 	gd->flags |= GD_FLG_ENV_READY;
 	gd->flags |= GD_FLG_ENV_DEFAULT;
-- 
2.32.0



More information about the U-Boot mailing list