mtd: cfi: Replace env_get_f() with env_get_yesno()

Simplify the code, replace env_get_f() with env_get_yesno(). The
env_get_yesno() internally calls env_get() which may fall back to
env_get_f() if the environment access is not initialized yet.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Stefan Roese <stefan.roese@mailbox.org>
This commit is contained in:
Marek Vasut
2026-08-10 14:22:08 -06:00
committed by Tom Rini
parent 3cafdbb9cb
commit c882fc0fe4
+1 -8
View File
@@ -2407,13 +2407,6 @@ unsigned long flash_init(void)
unsigned long size = 0;
int i;
#ifdef CONFIG_SYS_FLASH_PROTECTION
/* read environment from EEPROM */
char s[64];
env_get_f("unlock", s, sizeof(s));
#endif
#ifdef CONFIG_CFI_FLASH /* for driver model */
cfi_flash_init_dm();
#endif
@@ -2438,7 +2431,7 @@ unsigned long flash_init(void)
#endif /* CONFIG_SYS_FLASH_QUIET_TEST */
}
#ifdef CONFIG_SYS_FLASH_PROTECTION
else if (strcmp(s, "yes") == 0) {
else if (env_get_yesno("unlock")) {
/*
* Only the U-Boot image and it's environment
* is protected, all other sectors are