From: Simon Glass Date: Mon, 4 Dec 2017 14:28:18 -0700 Subject: [U-Boot] [PATCH v2 02/16] efi: Move the init check inside efi_init_obj_list() In-Reply-To: <20171204212832.130100-1-sjg@chromium.org> References: <20171204212832.130100-1-sjg@chromium.org> Message-ID: <20171204212832.130100-3-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Reviewed: Heinrich Schuchardt --- 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