bootcount: uboot_getenv() always return 0

This was crashing if bootcount variable was not set in U-Boot

Signed-off-by: Hector Bujanda <hector.bujanda@digi.com>
This commit is contained in:
Hector Bujanda 2025-02-04 17:46:43 +01:00
parent f95a707edc
commit 7357dabd61
1 changed files with 2 additions and 2 deletions

View File

@ -29,8 +29,8 @@ int read_bootcount_env() {
const char *var;
/* Obtain 'bootcount' value from environment. */
ret = uboot_getenv(ENV_VAR_BOOTCOUNT, &var);
if (!ret) {
uboot_getenv(ENV_VAR_BOOTCOUNT, &var);
if (var != NULL) {
/* Convert read value to integer. */
ret = (int)strtoul(var, &endptr, 10);
if (*endptr) {