All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing
@ 2023-01-18 16:12 Ilias Apalodimas
  2023-01-19 11:16 ` Etienne Carriere
  0 siblings, 1 reply; 10+ messages in thread
From: Ilias Apalodimas @ 2023-01-18 16:12 UTC (permalink / raw)
  To: u-boot; +Cc: Ilias Apalodimas, Heinrich Schuchardt

When we try to load EFI variables from a file in the ESP partition and the
file is missing We print a scary error looking like
=> printenv -e
** Unable to read file ubootefi.var **
Failed to load EFI variables

This is not an error though since the file wasn't there to begin with.
So silence the warning by aborting the load if the file is not there,
instead of failing the load.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 lib/efi_loader/efi_var_file.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index 62e071bd8341..7d7141473634 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -223,6 +223,12 @@ efi_status_t efi_var_from_file(void)
 		return EFI_OUT_OF_RESOURCES;
 	}
 
+	ret = efi_set_blk_dev_to_system_partition();
+	if (ret != EFI_SUCCESS)
+		goto error;
+	if (!fs_exists(EFI_VAR_FILE_NAME))
+		goto error;
+
 	ret = efi_set_blk_dev_to_system_partition();
 	if (ret != EFI_SUCCESS)
 		goto error;
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-20  8:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-18 16:12 [PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing Ilias Apalodimas
2023-01-19 11:16 ` Etienne Carriere
2023-01-19 11:45   ` Ilias Apalodimas
2023-01-19 12:42     ` Heinrich Schuchardt
2023-01-19 12:52       ` Ilias Apalodimas
2023-01-19 13:15         ` Etienne Carriere
2023-01-19 13:26           ` Ilias Apalodimas
2023-01-19 13:46             ` Ilias Apalodimas
2023-01-20  8:08               ` Etienne Carriere
2023-01-19 13:11     ` Etienne Carriere

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.