u-boot/env
Martin Fuzzey 2c54957d5c env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE
commit 9636bf8b2e upstream.

Since commit 0f036bf4b8 ("env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set")
a warning message is displayed when setenv -f is used WITHOUT
CONFIG_ENV_ACCESS_IGNORE_FORCE, but the variable is set anyway, resulting
in lots of log pollution.

env_flags_validate() returns 0 if the access is accepted, or non zero
if it is refused.

So the original code
	#ifndef CONFIG_ENV_ACCESS_IGNORE_FORCE
		if (flag & H_FORCE)
			return 0;
	#endif

was correct, it returns 0 (accepts the modification) if forced UNLESS
IGNORE_FORCE is set (in which case access checks in the following code
are applied). The broken patch just added a printf to the force accepted
case.

To obtain the intent of the patch we need this:
	if (flag & H_FORCE) {
	#ifdef CONFIG_ENV_ACCESS_IGNORE_FORCE
		printf("## Error: Can't force access to \"%s\"\n", name);
	#else
		return 0;
	#endif
	}

Fixes: 0f036bf4b8 ("env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set")

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
[s-anna@ti.com: cherry-pick commit '9636bf8b2e31' from v2021.07-rc1]
Signed-off-by: Suman Anna <s-anna@ti.com>
2021-05-04 22:51:31 -05:00
..
Kconfig env: Access Environment in SPI flashes before relocation 2020-10-30 10:54:38 -04:00
Makefile env: remove callback.o for an SPL build 2020-04-24 10:09:59 -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 make env_entry::callback conditional on !CONFIG_SPL_BUILD 2020-04-24 10:09:59 -04:00
common.c env: split env_import_redund() into 2 functions 2020-10-30 10:54:38 -04:00
eeprom.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
embedded.c env: Finish migration of common ENV options 2019-11-20 18:32:09 -05:00
env.c env: sf: fix init function behaviour 2020-11-03 10:04:25 -05:00
ext4.c env/ext4.c: allow loading from an EXT4 partition on the MMC boot device 2020-10-14 11:16:34 -04:00
fat.c mmc: remove duplicate mmc_get_env_dev() implementations 2020-10-14 11:16:34 -04:00
flags.c env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE 2021-05-04 22:51:31 -05:00
flash.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
mmc.c env: mmc: Correct partition comparison in mmc_offset_try_partition 2020-11-18 13:46:58 -05:00
nand.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
nowhere.c env: typo enougth 2020-11-19 09:45:49 -05:00
nvram.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
onenand.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
remote.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
sata.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
sf.c env: sf: fix init function behaviour 2020-11-03 10:04:25 -05:00
ubi.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00