提交 a1eac57a 编写于 作者: P Phil Sutter 提交者: Scott Wood

common/env_nand.c: calculate crc only when readenv was OK

Calculating the checksum of incompletely read data is useless.
Signed-off-by: NPhil Sutter <phil.sutter@viprinet.com>
[scottwood@freescale.com: minor formatting fix]
Signed-off-by: NScott Wood <scottwood@freescale.com>
上级 b76a147b
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册