
We should check the result of efi_add_memory_map() against the first input parameter, not against zero.
In efi_carve_out_dt_rsv() add_efi_memory_map() gets passed addr = 0. The function succeeds but the parsing routine interprets zero as an error.
Fix that now by comparing the result code of add_efi_memory_map() to the first input parameter as other users of add_efi_memory_map() already do.
Removes this error on raspberrypi 3 boot: "FDT memrsv map 0: Failed to add to map".
Fixes: 416e07e2cfcf ("efi: Drop error return in efi_carve_out_dt_rsv()") Cc: Heinrich Schuchardt xypron.glpk@gmx.de Cc: Alexander Graf agraf@csgraf.de Signed-off-by: Bryan O'Donoghue pure.logic@nexus-software.ie --- cmd/bootefi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index c19256e00d..0b404ccbd1 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -169,8 +169,8 @@ static void efi_carve_out_dt_rsv(void *fdt)
pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK)); addr &= ~EFI_PAGE_MASK; - if (!efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE, - false)) + if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE, + false) != addr) printf("FDT memrsv map %d: Failed to add to map\n", i); } }