From 4861ad01ada1edc607086b2308016e92d2d43edd Mon Sep 17 00:00:00 2001 From: Sergei Lissianoi <54454955+selissia@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:27:27 -0400 Subject: [PATCH] Reset the OTARequestor state if the downloaded image is invalid (#26230) --- src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp | 4 ++++ src/platform/silabs/efr32/OTAImageProcessorImpl.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp b/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp index a838564d919520..2cfcc9694267e9 100644 --- a/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp @@ -190,6 +190,8 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) if (err != SL_BOOTLOADER_OK) { ChipLogError(SoftwareUpdate, "ERROR: bootloader_verifyImage() error %ld", err); + // Call the OTARequestor API to reset the state + GetRequestorInstance()->CancelImageUpdate(); return; } @@ -198,6 +200,8 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) if (err != SL_BOOTLOADER_OK) { ChipLogError(SoftwareUpdate, "ERROR: bootloader_setImageToBootload() error %ld", err); + // Call the OTARequestor API to reset the state + GetRequestorInstance()->CancelImageUpdate(); return; } diff --git a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp index 83b815568b24fa..6d2bce9fdfb41b 100644 --- a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp @@ -201,6 +201,8 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) if (err != SL_BOOTLOADER_OK) { ChipLogError(SoftwareUpdate, "ERROR: bootloader_verifyImage() error %ld", err); + // Call the OTARequestor API to reset the state + GetRequestorInstance()->CancelImageUpdate(); return; } @@ -209,6 +211,8 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) if (err != SL_BOOTLOADER_OK) { ChipLogError(SoftwareUpdate, "ERROR: bootloader_setImageToBootload() error %ld", err); + // Call the OTARequestor API to reset the state + GetRequestorInstance()->CancelImageUpdate(); return; }