summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2022-09-18 20:02:44 +0200
committerArd Biesheuvel <ardb@kernel.org>2022-09-26 22:30:18 +0200
commita12b78b5714456e276b9545005f518802a319af9 (patch)
treef1b943395c24faea9c006b9b408f23d6bd2e7545
parentefi: libstub: simplify efi_get_memory_map() and struct efi_boot_memmap (diff)
downloadlinux-a12b78b5714456e276b9545005f518802a319af9.tar.xz
linux-a12b78b5714456e276b9545005f518802a319af9.zip
efi: libstub: remove pointless goto kludge
Remove some goto cruft that serves no purpose and obfuscates the code. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 85c68aa83673..63f3c2cd7058 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -438,13 +438,14 @@ efi_status_t efi_exit_boot_services(void *handle, void *priv,
efi_status_t status;
status = efi_get_memory_map(&map);
-
if (status != EFI_SUCCESS)
- goto fail;
+ return status;
status = priv_func(map, priv);
- if (status != EFI_SUCCESS)
- goto free_map;
+ if (status != EFI_SUCCESS) {
+ efi_bs_call(free_pool, map);
+ return status;
+ }
if (efi_disable_pci_dma)
efi_pci_disable_bridge_busmaster();
@@ -475,25 +476,16 @@ efi_status_t efi_exit_boot_services(void *handle, void *priv,
/* exit_boot_services() was called, thus cannot free */
if (status != EFI_SUCCESS)
- goto fail;
+ return status;
status = priv_func(map, priv);
/* exit_boot_services() was called, thus cannot free */
if (status != EFI_SUCCESS)
- goto fail;
+ return status;
status = efi_bs_call(exit_boot_services, handle, map->map_key);
}
- /* exit_boot_services() was called, thus cannot free */
- if (status != EFI_SUCCESS)
- goto fail;
-
- return EFI_SUCCESS;
-
-free_map:
- efi_bs_call(free_pool, map);
-fail:
return status;
}