u-boot/env
Martin Fuzzey 9636bf8b2e env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE
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>
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: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE 2021-04-16 11:55:55 -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