From: Denis Mukhin <[email protected]> Autoboot calls into bootcount_inc()/bootcount_error() which rely on environment variable.
Specifically, it may corrupt the state of a GPT-backed counter. Gate bootcount_inc()/bootcount_error() by !CONFIG_DM_BOOTCOUNT_GPT to compile out bootcount_store() calls on autoboot path. Signed-off-by: Denis Mukhin <[email protected]> --- include/bootcount.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/bootcount.h b/include/bootcount.h index 86474569d365..8aae3cb7ff1b 100644 --- a/include/bootcount.h +++ b/include/bootcount.h @@ -74,7 +74,8 @@ void bootcount_store(ulong); */ ulong bootcount_load(void); -#if defined(CONFIG_SPL_BOOTCOUNT_LIMIT) || defined(CONFIG_TPL_BOOTCOUNT_LIMIT) || defined(CONFIG_BOOTCOUNT_LIMIT) +#if (defined(CONFIG_SPL_BOOTCOUNT_LIMIT) || defined(CONFIG_TPL_BOOTCOUNT_LIMIT) || defined(CONFIG_BOOTCOUNT_LIMIT)) && \ + !defined(CONFIG_DM_BOOTCOUNT_GPT) #ifdef CONFIG_SYS_BOOTCOUNT_LE static inline void raw_bootcount_store(volatile u32 *addr, u32 data) -- 2.54.0

