aboutsummaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-03-03 15:28:58 +0100
committerAlexander Graf <agraf@suse.de>2018-04-04 11:00:06 +0200
commit098a6cdd1cc519f6c75b5e5de91c6655500a188a (patch)
treeb8b52fe85597f69b6313aaaf8c7eabb4950e04b7 /cmd/bootefi.c
parentd7b181d57d0c7080facce755c4b9ff7a22436a48 (diff)
downloadu-boot-098a6cdd1cc519f6c75b5e5de91c6655500a188a.zip
u-boot-098a6cdd1cc519f6c75b5e5de91c6655500a188a.tar.gz
u-boot-098a6cdd1cc519f6c75b5e5de91c6655500a188a.tar.bz2
efi_loader: simplify calling efi_init_obj_list
efi_init_obj_list() should be executed only once. 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(). Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 6546272..3f4f214 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -22,7 +22,7 @@
DECLARE_GLOBAL_DATA_PTR;
-static uint8_t efi_obj_list_initalized;
+static u8 efi_obj_list_initialized;
static struct efi_device_path *bootefi_image_path;
static struct efi_device_path *bootefi_device_path;
@@ -30,7 +30,10 @@ static struct efi_device_path *bootefi_device_path;
/* Initialize and populate EFI object list */
static void efi_init_obj_list(void)
{
- efi_obj_list_initalized = 1;
+ /* Initialize once only */
+ if (efi_obj_list_initialized)
+ return;
+ efi_obj_list_initialized = 1;
/* Initialize EFI driver uclass */
efi_driver_init();
@@ -184,8 +187,7 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt,
}
/* Initialize and populate EFI object list */
- if (!efi_obj_list_initalized)
- efi_init_obj_list();
+ efi_init_obj_list();
efi_setup_loaded_image(&loaded_image_info, &loaded_image_info_obj,
device_path, image_path);
@@ -284,8 +286,7 @@ static int do_bootefi_bootmgr_exec(unsigned long fdt_addr)
efi_status_t r;
/* Initialize and populate EFI object list */
- if (!efi_obj_list_initalized)
- efi_init_obj_list();
+ efi_init_obj_list();
/*
* gd lives in a fixed register which may get clobbered while we execute
@@ -350,8 +351,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();
/* Transfer environment variable efi_selftest as load options */
set_load_options(&loaded_image_info, "efi_selftest");
/* Execute the test */