mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-07 23:31:36 +00:00
common/env_nand.c: calculate crc only when readenv was OK
Calculating the checksum of incompletely read data is useless. Signed-off-by: Phil Sutter <phil.sutter@viprinet.com> [scottwood@freescale.com: minor formatting fix] Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
b76a147b72
commit
a1eac57a20
1 changed files with 4 additions and 2 deletions
|
@ -352,8 +352,10 @@ void env_relocate_spec(void)
|
||||||
puts("*** Warning - some problems detected "
|
puts("*** Warning - some problems detected "
|
||||||
"reading environment; recovered successfully\n");
|
"reading environment; recovered successfully\n");
|
||||||
|
|
||||||
crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
|
crc1_ok = !read1_fail &&
|
||||||
crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc;
|
(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) {
|
if (!crc1_ok && !crc2_ok) {
|
||||||
set_default_env("!bad CRC");
|
set_default_env("!bad CRC");
|
||||||
|
|
Loading…
Add table
Reference in a new issue