env: Don't set ready flag if import failed in env_set_default()

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@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Marek Behún 2021-11-04 00:23:21 +01:00 committed by Simon Glass
parent 0427bed63b
commit c9db4c5440

4
env/common.c vendored
View file

@ -261,9 +261,11 @@ void env_set_default(const char *s, int flags)
flags |= H_DEFAULT; flags |= H_DEFAULT;
if (himport_r(&env_htab, default_environment, if (himport_r(&env_htab, default_environment,
sizeof(default_environment), '\0', flags, 0, sizeof(default_environment), '\0', flags, 0,
0, NULL) == 0) 0, NULL) == 0) {
pr_err("## Error: Environment import failed: errno = %d\n", pr_err("## Error: Environment import failed: errno = %d\n",
errno); errno);
return;
}
gd->flags |= GD_FLG_ENV_READY; gd->flags |= GD_FLG_ENV_READY;
gd->flags |= GD_FLG_ENV_DEFAULT; gd->flags |= GD_FLG_ENV_DEFAULT;