[PATCH v2] efi_loader: Fix UEFI error handling
Weizhao Ouyang
o451686892 at gmail.com
Mon Nov 13 17:08:23 CET 2023
Try to catch error the earlier way.
Signed-off-by: Weizhao Ouyang <o451686892 at gmail.com>
---
Changes in v2:
- Avoid to stop the boot process.
lib/efi_loader/efi_var_file.c | 4 +++-
lib/efi_loader/efi_variable.c | 2 --
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index 62e071bd83..fe1c462f17 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -192,8 +192,10 @@ efi_status_t efi_var_restore(struct efi_var_file *buf, bool safe)
ret = efi_var_mem_ins(var->name, &var->guid, var->attr,
var->length, data, 0, NULL,
var->time);
- if (ret != EFI_SUCCESS)
+ if (ret != EFI_SUCCESS) {
log_err("Failed to set EFI variable %ls\n", var->name);
+ return ret;
+ }
}
return EFI_SUCCESS;
}
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index be95ed44e6..2b2ca8c090 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -350,8 +350,6 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
if (var_type == EFI_AUTH_VAR_PK)
ret = efi_init_secure_state();
- else
- ret = EFI_SUCCESS;
/*
* Write non-volatile EFI variables to file
--
2.39.2
More information about the U-Boot
mailing list