mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-30 19:11:37 +00:00
efi_loader: Fix return value for efi_add_runtime_mmio
The efi_add_runtime_mmio function incorrectly returned the added address as return value rather than EFI_SUCCESS. Fix it by checking the return value of efi_add_memory_map properly. Fixes: f057cfef5dc ("efi_loader: exit status for efi_reset_system_init") Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
8e47506409
commit
813468cdbd
1 changed files with 7 additions and 7 deletions
|
@ -349,13 +349,13 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
|
||||||
efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
|
efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
|
||||||
{
|
{
|
||||||
struct efi_runtime_mmio_list *newmmio;
|
struct efi_runtime_mmio_list *newmmio;
|
||||||
efi_status_t ret;
|
|
||||||
|
|
||||||
u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
|
u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
|
||||||
ret = efi_add_memory_map(*(uintptr_t *)mmio_ptr, pages, EFI_MMAP_IO,
|
uint64_t addr = *(uintptr_t *)mmio_ptr;
|
||||||
false);
|
uint64_t retaddr;
|
||||||
if (ret != EFI_SUCCESS)
|
|
||||||
return ret;
|
retaddr = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false);
|
||||||
|
if (retaddr != addr)
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
|
||||||
newmmio = calloc(1, sizeof(*newmmio));
|
newmmio = calloc(1, sizeof(*newmmio));
|
||||||
if (!newmmio)
|
if (!newmmio)
|
||||||
|
@ -365,7 +365,7 @@ efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
|
||||||
newmmio->len = len;
|
newmmio->len = len;
|
||||||
list_add_tail(&newmmio->link, &efi_runtime_mmio);
|
list_add_tail(&newmmio->link, &efi_runtime_mmio);
|
||||||
|
|
||||||
return ret;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue