diff mbox series

[10/12] efi: libstub: remove pointless goto kludge

Message ID 20220918213544.2176249-11-ardb@kernel.org
State Superseded
Headers show
Series efi: disentangle the generic EFI stub from FDT | expand

Commit Message

Ard Biesheuvel Sept. 18, 2022, 9:35 p.m. UTC
Remove some goto cruft that serves no purpose and obfuscates the code.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/libstub/efi-stub-helper.c | 22 +++++++-------------
 1 file changed, 7 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index f1f7a823be17..76a1a395fad4 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -439,13 +439,14 @@  efi_status_t efi_exit_boot_services(void *handle, void *priv,
 	efi_status_t status;
 
 	status = efi_get_memory_map(&map, true);
-
 	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();
@@ -476,25 +477,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;
 }