[U-Boot] [PATCH v2 02/16] efi: Move the init check inside efi_init_obj_list()

Simon Glass sjg at chromium.org
Mon Dec 4 21:28:18 UTC 2017


Rather than having the caller check this variable and the callee set it,
move all access to the variable inside the function. This reduces the
logic needed to call efi_init_obj_list().

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed: Heinrich Schuchardt <xypron.glpk at gmx.de>
---

Changes in v2: None

 cmd/bootefi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 478bc116e2..17b26e6f4e 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -28,6 +28,8 @@ static struct efi_device_path *bootefi_device_path;
 /* Initialize and populate EFI object list */
 static void efi_init_obj_list(void)
 {
+	if (efi_obj_list_initalized)
+		return;
 	efi_obj_list_initalized = 1;
 
 	efi_console_register();
@@ -208,6 +210,9 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
 	env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
 		"{ro,boot}(blob)0000000000000000");
 
+	/* Initialize and populate EFI object list */
+	efi_init_obj_list();
+
 	/* Call our payload! */
 	debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
 
@@ -310,6 +315,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		/* Initialize and populate EFI object list */
 		if (!efi_obj_list_initalized)
 			efi_init_obj_list();
+		loaded_image_info.device_handle = bootefi_device_path;
+		loaded_image_info.file_path = bootefi_image_path;
 		return efi_selftest(&loaded_image_info, &systab);
 	} else
 #endif
-- 
2.15.0.531.g2ccb3012c9-goog



More information about the U-Boot mailing list