diff mbox series

[U-Boot,v2,4/7] bootcount: u-boot: Do not increment bootcount if already done in SPL

Message ID 20180314172450.8385-5-lukma@denx.de
State Changes Requested
Delegated to: Stefan Roese
Headers show
Series Provide SPL support for bootcount (in the case of using falcon boot mode) | expand

Commit Message

Lukasz Majewski March 14, 2018, 5:24 p.m. UTC
If the CONFIG_SPL_BOOTCOUNT_LIMIT is defined, the bootcount variable is
already incremented after each boot attempt.

For that reason we shall not increment it again in u-boot.

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---

Changes in v2:
- None

 common/autoboot.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefan Roese March 21, 2018, 10:06 a.m. UTC | #1
On 14.03.2018 18:24, Lukasz Majewski wrote:
> If the CONFIG_SPL_BOOTCOUNT_LIMIT is defined, the bootcount variable is
> already incremented after each boot attempt.
> 
> For that reason we shall not increment it again in u-boot.
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> 
> ---
> 
> Changes in v2:
> - None
> 
>   common/autoboot.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/common/autoboot.c b/common/autoboot.c
> index 2eef7a04cc..87fca2ea92 100644
> --- a/common/autoboot.c
> +++ b/common/autoboot.c
> @@ -298,7 +298,9 @@ const char *bootdelay_process(void)
>   
>   #ifdef CONFIG_BOOTCOUNT_LIMIT
>   	bootcount = bootcount_load();
> +#ifndef CONFIG_SPL_BOOTCOUNT_LIMIT
>   	bootcount++;
> +#endif

As mentioned in my other comment, please use the helper functions
here as well. Perhaps you can move this #ifdef into the helper
function, making this part here a bit clearer.

Thanks,
Stefan
diff mbox series

Patch

diff --git a/common/autoboot.c b/common/autoboot.c
index 2eef7a04cc..87fca2ea92 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -298,7 +298,9 @@  const char *bootdelay_process(void)
 
 #ifdef CONFIG_BOOTCOUNT_LIMIT
 	bootcount = bootcount_load();
+#ifndef CONFIG_SPL_BOOTCOUNT_LIMIT
 	bootcount++;
+#endif
 	bootcount_store(bootcount);
 	env_set_ulong("bootcount", bootcount);
 	bootlimit = env_get_ulong("bootlimit", 10, 0);