From d25d925cb06b7390af0bc23143d703393528f68f Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Fri, 12 May 2023 22:11:18 +0800 Subject: [PATCH] [ota] cancelupdate and progress state from kApplying to kIdle when HandleApply fails (#26499) --- src/platform/Ameba/AmebaOTAImageProcessor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/Ameba/AmebaOTAImageProcessor.cpp b/src/platform/Ameba/AmebaOTAImageProcessor.cpp index 5db732fcff71d0..e605ba7741fb4a 100644 --- a/src/platform/Ameba/AmebaOTAImageProcessor.cpp +++ b/src/platform/Ameba/AmebaOTAImageProcessor.cpp @@ -400,6 +400,7 @@ void AmebaOTAImageProcessor::HandleApply(intptr_t context) if (imageProcessor == nullptr) { ChipLogError(SoftwareUpdate, "ImageProcessor context is null"); + GetRequestorInstance()->CancelImageUpdate(); return; } @@ -409,12 +410,14 @@ void AmebaOTAImageProcessor::HandleApply(intptr_t context) { ota_update_free(imageProcessor->pOtaTgtHdr); ChipLogError(SoftwareUpdate, "OTA update signature failed"); + GetRequestorInstance()->CancelImageUpdate(); return; } #elif defined(CONFIG_PLATFORM_8710C) if (update_ota_signature(imageProcessor->signature, imageProcessor->flash_addr) < 0) { ChipLogError(SoftwareUpdate, "OTA update signature failed"); + GetRequestorInstance()->CancelImageUpdate(); return; } #endif