]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: return the correct error in efi_bootmgr_release_uridp()
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Mon, 12 Aug 2024 20:56:38 +0000 (23:56 +0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 12 Sep 2024 15:32:18 +0000 (17:32 +0200)
There's currently a chance for this function to overwrite an error if
one occurred and the subsequent call to
efi_uninstall_multiple_protocol_interfaces() succedded. Although this
is an EFI event and we can't do much let's at least set and return
the correct error

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
lib/efi_loader/efi_bootmgr.c

index 03cdee15017d7bbd3140388f69fe357a353f811a..a3aa2b8d1b9237a40b06aa18261263d2d3193210 100644 (file)
@@ -388,6 +388,7 @@ err:
 efi_status_t efi_bootmgr_release_uridp(struct uridp_context *ctx)
 {
        efi_status_t ret = EFI_SUCCESS;
+       efi_status_t ret2 = EFI_SUCCESS;
 
        if (!ctx)
                return ret;
@@ -407,17 +408,18 @@ efi_status_t efi_bootmgr_release_uridp(struct uridp_context *ctx)
 
        /* cleanup for PE-COFF image */
        if (ctx->mem_handle) {
-               ret = efi_uninstall_multiple_protocol_interfaces(
-                       ctx->mem_handle, &efi_guid_device_path, ctx->loaded_dp,
-                       NULL);
-               if (ret != EFI_SUCCESS)
+               ret2 = efi_uninstall_multiple_protocol_interfaces(ctx->mem_handle,
+                                                                 &efi_guid_device_path,
+                                                                 ctx->loaded_dp,
+                                                                 NULL);
+               if (ret2 != EFI_SUCCESS)
                        log_err("Uninstall device_path protocol failed\n");
        }
 
        efi_free_pool(ctx->loaded_dp);
        free(ctx);
 
-       return ret;
+       return ret == EFI_SUCCESS ? ret2 : ret;
 }
 
 /**