
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@chromium.org ---
cmd/bootefi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index abfab8fa98..2c9d31c5eb 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -109,6 +109,8 @@ static struct efi_object bootefi_device_obj = { /* Initialize and populate EFI object list */ static void efi_init_obj_list(void) { + if (efi_obj_list_initalized) + return; efi_obj_list_initalized = 1;
list_add_tail(&loaded_image_info_obj.link, &efi_obj_list); @@ -256,8 +258,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt) return -ENOENT;
/* Initialize and populate EFI object list */ - if (!efi_obj_list_initalized) - efi_init_obj_list(); + efi_init_obj_list();
/* Call our payload! */ debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry); @@ -311,8 +312,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) */ efi_save_gd(); /* Initialize and populate EFI object list */ - if (!efi_obj_list_initalized) - efi_init_obj_list(); + 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);