Message ID | 20240316093644.54869-3-heinrich.schuchardt@canonical.com |
---|---|
State | Accepted, archived |
Commit | 46e5dd661c82a99b9ac8d302cbbc575f74b6b08b |
Delegated to: | Heinrich Schuchardt |
Headers | show |
Series | cmd: bootefi: fix error handling | expand |
On Sat, 16 Mar 2024 at 11:37, Heinrich Schuchardt <heinrich.schuchardt@canonical.com> wrote: > > If an EFI binary returns an error code EFI_INVALID_PARAMETER, we show the > usage help for the bootefi command: > > Shell> exit 0x8000000000000002 > ## Application failed, r = 2 > bootefi - Boots an EFI payload from memory > > Usage: > bootefi <image address>[:<image size>] [<fdt address>] > - boot EFI payload > bootefi bootmgr [fdt address] > - load and boot EFI payload based on BootOrder/BootXXXX variables. > > If specified, the device tree located at <fdt address> gets > exposed as EFI configuration table. > > This makes no sense. > > Fixes: 296faf4f7ef1 ("cmd: bootefi: re-organize do_bootefi()") > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > --- > cmd/bootefi.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > index 9cf9027bf40..b509440cde0 100644 > --- a/cmd/bootefi.c > +++ b/cmd/bootefi.c > @@ -154,9 +154,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, > !strcmp(argv[1], "bootmgr")) { > ret = efi_bootmgr_run(fdt); > > - if (ret == EFI_INVALID_PARAMETER) > - return CMD_RET_USAGE; > - else if (ret) > + if (ret != EFI_SUCCESS) > return CMD_RET_FAILURE; > > return CMD_RET_SUCCESS; > @@ -218,9 +216,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, > > ret = efi_binary_run(image_buf, size, fdt); > > - if (ret == EFI_INVALID_PARAMETER) > - return CMD_RET_USAGE; > - else if (ret) > + if (ret != EFI_SUCCESS) > return CMD_RET_FAILURE; > > return CMD_RET_SUCCESS; > -- > 2.43.0 > Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 9cf9027bf40..b509440cde0 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -154,9 +154,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, !strcmp(argv[1], "bootmgr")) { ret = efi_bootmgr_run(fdt); - if (ret == EFI_INVALID_PARAMETER) - return CMD_RET_USAGE; - else if (ret) + if (ret != EFI_SUCCESS) return CMD_RET_FAILURE; return CMD_RET_SUCCESS; @@ -218,9 +216,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, ret = efi_binary_run(image_buf, size, fdt); - if (ret == EFI_INVALID_PARAMETER) - return CMD_RET_USAGE; - else if (ret) + if (ret != EFI_SUCCESS) return CMD_RET_FAILURE; return CMD_RET_SUCCESS;
If an EFI binary returns an error code EFI_INVALID_PARAMETER, we show the usage help for the bootefi command: Shell> exit 0x8000000000000002 ## Application failed, r = 2 bootefi - Boots an EFI payload from memory Usage: bootefi <image address>[:<image size>] [<fdt address>] - boot EFI payload bootefi bootmgr [fdt address] - load and boot EFI payload based on BootOrder/BootXXXX variables. If specified, the device tree located at <fdt address> gets exposed as EFI configuration table. This makes no sense. Fixes: 296faf4f7ef1 ("cmd: bootefi: re-organize do_bootefi()") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> --- cmd/bootefi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)