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:
parent
f95a707edc
commit
7357dabd61
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue