From: Heinrich Schuchardt Date: Mon, 20 Apr 2026 22:03:18 +0000 (+0200) Subject: cmd/bootefi: move efi_init_obj_list() to the start of do_bootefi X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7311130b73a67ece4984cfc2c1fb31b002cf1a48;p=thirdparty%2Fu-boot.git cmd/bootefi: move efi_init_obj_list() to the start of do_bootefi None of the bootefi commands can be executed if the EFI sub-system cannot be initialized. Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 85f41c3b0a0..6dab709e507 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -142,6 +142,14 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 2) return CMD_RET_USAGE; + /* Initialize EFI drivers */ + ret = efi_init_obj_list(); + if (ret != EFI_SUCCESS) { + log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n", + ret & ~EFI_ERROR_MASK); + return CMD_RET_FAILURE; + } + if (argc > 2) { ulong rd_addr = 0; char *end = strchr(argv[2], ':'); @@ -179,14 +187,6 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, if (IS_ENABLED(CONFIG_CMD_BOOTEFI_SELFTEST) && !strcmp(argv[1], "selftest")) { - /* Initialize EFI drivers */ - ret = efi_init_obj_list(); - if (ret != EFI_SUCCESS) { - log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n", - ret & ~EFI_ERROR_MASK); - return CMD_RET_FAILURE; - } - ret = efi_install_fdt(fdt); if (ret != EFI_SUCCESS) return CMD_RET_FAILURE;