diff mbox series

[RFC,07/14] cmd: terminate efidebug test bootmgr early on error

Message ID 20240426141321.232236-8-heinrich.schuchardt@canonical.com
State Accepted, archived
Commit 84aab11d3503a555ca6349da76efa4f4aedfc136
Delegated to: Heinrich Schuchardt
Headers show
Series efi_loader: improve device-tree loading | expand

Commit Message

Heinrich Schuchardt April 26, 2024, 2:13 p.m. UTC
If efi_bootmgr_load() fails, there is no point in trying to start an image
that has not been loaded.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 cmd/efidebug.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 30def6b6831..9a1b38c352b 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1459,6 +1459,8 @@  static __maybe_unused int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
 
 	ret = efi_bootmgr_load(&image, &load_options);
 	printf("efi_bootmgr_load() returned: %ld\n", ret & ~EFI_ERROR_MASK);
+	if (ret != EFI_SUCCESS)
+		return CMD_RET_SUCCESS;
 
 	/* We call efi_start_image() even if error for test purpose. */
 	ret = EFI_CALL(efi_start_image(image, &exit_data_size, &exit_data));