summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/env_nand.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/env_nand.c b/common/env_nand.c
index 382e8ae..5b69889 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -352,8 +352,10 @@ void env_relocate_spec(void)
puts("*** Warning - some problems detected "
"reading environment; recovered successfully\n");
- crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
- crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc;
+ crc1_ok = !read1_fail &&
+ (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc);
+ crc2_ok = !read2_fail &&
+ (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc);
if (!crc1_ok && !crc2_ok) {
set_default_env("!bad CRC");