efi_mgr_boot() assigns the status returned by efi_bootmgr_run() to a local variable and then returns 0. A zero return from a bootmeth's boot() method means "should not get here", so bootflow_boot() reports -EFAULT for every boot manager failure and the real cause (no boot option loadable, load error, ...) is lost. The unused assignment also trips -Wunused-but-set-variable on newer compilers.
Map the EFI status to an errno instead: EFI_NOT_FOUND (no BootOrder) becomes -ENOENT and any other failure -EIO. Signed-off-by: Aristo Chen <[email protected]> --- boot/bootmeth_efi_mgr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boot/bootmeth_efi_mgr.c b/boot/bootmeth_efi_mgr.c index 6e70c36ad99..eb4d9a5b5a6 100644 --- a/boot/bootmeth_efi_mgr.c +++ b/boot/bootmeth_efi_mgr.c @@ -84,10 +84,13 @@ static int efi_mgr_read_file(struct udevice *dev, struct bootflow *bflow, static int efi_mgr_boot(struct udevice *dev, struct bootflow *bflow) { - int ret; + efi_status_t ret; /* Booting is handled by the 'bootefi bootmgr' command */ ret = efi_bootmgr_run(EFI_FDT_USE_INTERNAL); + if (ret != EFI_SUCCESS) + return log_msg_ret("mgr", + ret == EFI_NOT_FOUND ? -ENOENT : -EIO); return 0; } -- 2.43.0
