lib: updatehub: Add flash_img_init return value check
The flash_img_int return value is not checked for fail conditions. This can result on useless download attempts once image will not be properly recorded. Add return value check and on error execute default treatment. Fixes #26992. Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
This commit is contained in:
parent
8683b47b17
commit
32bafacc31
1 changed files with 5 additions and 1 deletions
|
@ -501,7 +501,11 @@ static enum updatehub_response install_update(void)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
flash_img_init(&ctx.flash_ctx);
|
||||
if (flash_img_init(&ctx.flash_ctx)) {
|
||||
LOG_ERR("Unable init flash");
|
||||
ctx.code_status = UPDATEHUB_FLASH_INIT_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ctx.downloaded_size = 0;
|
||||
updatehub_blk_set(UPDATEHUB_BLK_ATTEMPT, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue