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
This commit is contained in:
Andrew Tridgell 2023-07-09 07:07:26 +10:00
parent d98666832c
commit 5a84e988a5
1 changed files with 4 additions and 1 deletions

View File

@ -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