Skip to content

Commit

Permalink
env: Fix default environment saving issue
Browse files Browse the repository at this point in the history
When CONFIG_SYS_REDUNDAND_ENVIRONMENT is enabled, by default env is
getting saved to redundant environment irrespective of primary env is
present or not.

It means even if primary and redundant environment are not present, by
default, env is getting stored to redundant environment. Even if primary
env is present, it is choosing to store in redudndant env.

Ideally it should look for primary env and choose to store in primary env
if it is present. If both primary and redundant env are not present then
it should save in to primary env area.

Fix the issue by making env_valid = ENV_INVALID when both the
environments are not present.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
  • Loading branch information
Ashok Reddy Soma authored and trini committed Jul 17, 2023
1 parent 3430f24 commit 4dc5e26
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions env/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ int env_check_redund(const char *buf1, int buf1_read_fail,
tmp_env2->crc;

if (!crc1_ok && !crc2_ok) {
gd->env_valid = ENV_INVALID;
return -ENOMSG; /* needed for env_load() */
} else if (crc1_ok && !crc2_ok) {
gd->env_valid = ENV_VALID;
Expand Down

0 comments on commit 4dc5e26

Please sign in to comment.