Skip to contentSkip to conversation

efi_loader: Fix UEFI error handling

PATCH Superseded Weizhao Ouyang 1 participant 1 message Nov 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 efi_loader: Fix UEFI error handling

Try to catch error the earlier way.

---
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(-)
lib/efi_loader/efi_var_file.c +3 -1
index 62e071bd83..fe1c462f17 100644
@@ -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;
 }
lib/efi_loader/efi_variable.c +0 -2
index be95ed44e6..2b2ca8c090 100644
@@ -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
Signature · 1 line
2.39.2