Commit ec6db600 authored by Gerson Fernando Budke's avatar Gerson Fernando Budke Committed by Anas Nashif
Browse files

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: default avatarGerson Fernando Budke <gerson.budke@ossystems.com.br>
parent c2e60a4e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -513,7 +513,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);