[PATCH] env: flash: add catch-all for unrecognized flags in env_flash_init()

Tom Rini trini at konsulko.com
Thu Apr 2 20:45:56 CEST 2026


On Wed, 18 Mar 2026 14:15:15 -0700, Neil Berkman wrote:

> When both environment copies have valid CRCs but the flag bytes do not
> match any recognized pair, env_flash_init() falls through without
> setting gd->env_addr or gd->env_valid. This is a problem because:
> 
> 1. env_init() then sets gd->env_addr = &default_environment (in RAM).
> 
> 2. In env_flash_load(), the pointer comparison
>    gd->env_addr != &flash_addr->data evaluates true (RAM != flash),
>    triggering the pointer swap that selects the secondary copy.
> 
> [...]

Applied to u-boot/next, thanks!

[1/1] env: flash: add catch-all for unrecognized flags in env_flash_init()
      commit: ff7039032b7de3549b9b287b2c000c9e96c60380
-- 
Tom




More information about the U-Boot mailing list