u-boot/env
Brandon Maier b9c3052fbb env: increment redund flag on read fail
If one of the reads fails when importing redundant environments (a
single read failure), the env_flags wouldn't get initialized in
env_import_redund(). If a user then calls saveenv, the new environment
will have the wrong flags value. So on the next load the new environment
will be ignored.

While debugging this, I also noticed that env/sf.c was not correctly
handling a single read failure, as it would not check the crc before
assigning it to gd->env_addr.

Having a special error path for when there is a single read failure
seems unnecessary and may lead to future bugs. Instead collapse the
'single read failure' error to be the same as a 'single crc failure'.
That way env_check_redund() either passes or fails, and if it passes we
are guaranteed to have checked the CRC.

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Wolfgang Denk <wd@denx.de>
CC: Heiko Schocher <hs@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
2021-04-16 11:55:55 -04:00
..
attr.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
callback.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
common.c env: increment redund flag on read fail 2021-04-16 11:55:55 -04:00
eeprom.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
embedded.c env: Finish migration of common ENV options 2019-11-20 18:32:09 -05:00
env.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
ext4.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
fat.c mmc: remove duplicate mmc_get_env_dev() implementations 2020-10-14 11:16:34 -04:00
flags.c env: Add support for explicit write access list 2020-07-31 10:13:00 -04:00
flash.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
Kconfig env: add CONFIG_ENV_SECT_SIZE_AUTO 2021-04-16 11:55:55 -04:00
Makefile env: remove callback.o for an SPL build 2020-04-24 10:09:59 -04:00
mmc.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
nand.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
nowhere.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
nvram.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
onenand.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
remote.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
sata.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
sf.c env: increment redund flag on read fail 2021-04-16 11:55:55 -04:00
ubi.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00