Skip to content

Commit

Permalink
efi/libstub: Simplify efi_get_memory_map()
Browse files Browse the repository at this point in the history
Do not check the value of status twice.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Link: https://lore.kernel.org/r/20200216184050.3100-1-xypron.glpk@gmx.de
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
  • Loading branch information
Heinrich Schuchardt authored and Ard Biesheuvel committed Feb 23, 2020
1 parent eaa6fc6 commit e7ea37b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/firmware/efi/libstub/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ efi_status_t efi_get_memory_map(struct efi_boot_memmap *map)
goto again;
}

if (status != EFI_SUCCESS)
if (status == EFI_SUCCESS) {
if (map->key_ptr)
*map->key_ptr = key;
if (map->desc_ver)
*map->desc_ver = desc_version;
} else {
efi_bs_call(free_pool, m);

if (map->key_ptr && status == EFI_SUCCESS)
*map->key_ptr = key;
if (map->desc_ver && status == EFI_SUCCESS)
*map->desc_ver = desc_version;
}

fail:
*map->map = m;
Expand Down

0 comments on commit e7ea37b

Please sign in to comment.