]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fwu: print a message if empty capsule checks fail
authorSughosh Ganu <sughosh.ganu@linaro.org>
Mon, 9 Sep 2024 11:20:21 +0000 (16:50 +0530)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 19 Sep 2024 07:52:50 +0000 (10:52 +0300)
When dealing with processing of the empty capsule, the capsule gets
applied only when the checks for the empty capsule pass. Print a
message to highlight if empty capsule checks fail, and return an error
value, similar to the normal capsules.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Tested-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_capsule.c

index a4ea287303873cfa62add7cb1a758ebc51c58120..f8a4a7c6ef467db7d02b2d509061c0cc34a996a3 100644 (file)
@@ -564,9 +564,14 @@ static efi_status_t efi_capsule_update_firmware(
        bool fw_accept_os;
 
        if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) {
-               if (fwu_empty_capsule_checks_pass() &&
-                   fwu_empty_capsule(capsule_data))
-                       return fwu_empty_capsule_process(capsule_data);
+               if (fwu_empty_capsule(capsule_data)) {
+                       if (fwu_empty_capsule_checks_pass()) {
+                               return fwu_empty_capsule_process(capsule_data);
+                       } else {
+                               log_err("FWU empty capsule checks failed. Cannot start update\n");
+                               return EFI_INVALID_PARAMETER;
+                       }
+               }
 
                if (!fwu_update_checks_pass()) {
                        log_err("FWU checks failed. Cannot start update\n");