From 5a84e988a55df391c4aa798b6ffe67fdb587d76f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Jul 2023 07:07:26 +1000 Subject: [PATCH] AP_CheckFirmware: fixed error code for bad firmware when we have a bad unsigned firmware we check if it is a good signed firmware. If it is then we should return OK, if not we should return the original error code, otherwise we end up giving a misleading reason for not booting a peripheral --- libraries/AP_CheckFirmware/AP_CheckFirmware.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_CheckFirmware/AP_CheckFirmware.cpp b/libraries/AP_CheckFirmware/AP_CheckFirmware.cpp index 940048e8b5..0dce6f8103 100644 --- a/libraries/AP_CheckFirmware/AP_CheckFirmware.cpp +++ b/libraries/AP_CheckFirmware/AP_CheckFirmware.cpp @@ -192,7 +192,10 @@ check_fw_result_t check_good_firmware(void) // allows for booting of a signed firmware with an unsigned // bootloader, which allows for bootstrapping a system up from // unsigned to signed - return check_good_firmware_signed(); + const auto ret2 = check_good_firmware_signed(); + if (ret2 == check_fw_result_t::CHECK_FW_OK) { + return check_fw_result_t::CHECK_FW_OK; + } } return ret; #endif