[PATCH 2/3] EFI: Do not read OsIndications variable if EFI_IGNORE_OSINDICATIONS is enabled

Sughosh Ganu sughosh.ganu at linaro.org
Tue May 31 09:15:34 CEST 2022


The EFI_IGNORE_OSINDICATIONS config symbol was introduced as a
mechanism to have capsule updates work even on platforms where the
SetVariable runtime service was not supported. The current logic
requires the OsIndications variable to have been set to a 64 bit value
even when the EFI_IGNORE_OSINDICATIONS config is enabled. Move the
check to see if the config symbol is enabled at the beginning of the
function. If the config is enabled, return a success code without
checking for the existence of the variable.

Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
---
 lib/efi_loader/efi_capsule.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index c76a5f3570..0ea21dc168 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -1062,6 +1062,9 @@ static efi_status_t check_run_capsules(void)
 	efi_uintn_t size;
 	efi_status_t r;
 
+	if (IS_ENABLED(CONFIG_EFI_IGNORE_OSINDICATIONS))
+		return EFI_SUCCESS;
+
 	size = sizeof(os_indications);
 	r = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid,
 				 NULL, &size, &os_indications, NULL);
@@ -1082,8 +1085,6 @@ static efi_status_t check_run_capsules(void)
 		if (r != EFI_SUCCESS)
 			log_err("Setting %ls failed\n", L"OsIndications");
 		return EFI_SUCCESS;
-	} else if (IS_ENABLED(CONFIG_EFI_IGNORE_OSINDICATIONS)) {
-		return EFI_SUCCESS;
 	} else  {
 		return EFI_NOT_FOUND;
 	}
-- 
2.25.1



More information about the U-Boot mailing list