From: Jose Marinho Date: Mon, 19 Apr 2021 13:54:33 +0000 (+0100) Subject: efi: Fix ESRT refresh after Capsule update X-Git-Tag: v2025.01-rc5-pxa1908~1905^2~2 X-Git-Url: http://git.dujemihanovic.xyz/%22/img/sics.gif/%22/static/git-favicon.png?a=commitdiff_plain;h=3627cf4bff9b29cf9e41ad88b56f469a3675aba2;p=u-boot.git efi: Fix ESRT refresh after Capsule update Indicated by Coverity Scan CID 331147 The ESRT was being refreshed in situations where the UpdateCapsule procedure failed. In that scenario: 1) the ESRT refresh was superfluous. 2) a failed ESRT refresh return code overwrites the UpdateCapsule error return code. This commit ensures that the ESRT is only refreshed when the UpdateCapsule performs successfully. CC: Heinrich Schuchardt CC: Sughosh Ganu CC: AKASHI Takahiro CC: Tom Rini CC: Andre Przywara CC: nd@arm.com Signed-off-by: Jose Marinho Reviewed-by: Heinrich Schuchardt --- diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 691eda5e0d..a984c347e1 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -481,7 +481,6 @@ efi_status_t EFIAPI efi_update_capsule( if (ret != EFI_SUCCESS) goto out; } -out: if (IS_ENABLED(CONFIG_EFI_ESRT)) { /* Rebuild the ESRT to reflect any updated FW images. */ @@ -489,6 +488,7 @@ out: if (ret != EFI_SUCCESS) log_warning("EFI Capsule: failed to update ESRT\n"); } +out: return EFI_EXIT(ret); }