From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org
Cc: loongarch@lists.linux.dev, Ard Biesheuvel <ardb@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Huacai Chen <chenhuacai@loongson.cn>,
Xi Ruoyao <xry111@xry111.site>
Subject: [PATCH v2 4/8] efi: libstub: remove pointless goto kludge
Date: Tue, 20 Sep 2022 20:35:50 +0200 [thread overview]
Message-ID: <20220920183554.3870247-5-ardb@kernel.org> (raw)
In-Reply-To: <20220920183554.3870247-1-ardb@kernel.org>
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 --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;
}
--
2.35.1
next prev parent reply other threads:[~2022-09-20 18:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 18:35 [PATCH v2 0/8] efi: disentangle the generic EFI stub from FDT Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 1/8] efi: libstub: drop pointless get_memory_map() call Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 2/8] efi: libstub: avoid efi_get_memory_map() for allocating the virt map Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 3/8] efi: libstub: simplify efi_get_memory_map() and struct efi_boot_memmap Ard Biesheuvel
2022-09-20 18:35 ` Ard Biesheuvel [this message]
2022-09-20 18:35 ` [PATCH v2 5/8] efi: libstub: unify initrd loading between architectures Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 6/8] efi: libstub: remove DT dependency from generic stub Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 7/8] efi: libstub: install boot-time memory map as config table Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 8/8] efi/loongarch: libstub: remove dependency on flattened DT Ard Biesheuvel
2022-09-21 4:00 ` Huacai Chen
2022-09-21 8:14 ` Ard Biesheuvel
2022-09-22 2:15 ` Huacai Chen
2022-09-22 7:12 ` Ard Biesheuvel
2022-09-22 7:21 ` Huacai Chen
2022-09-22 7:24 ` Ard Biesheuvel
2022-09-22 7:41 ` Huacai Chen
2022-09-22 8:59 ` Ard Biesheuvel
2022-09-22 12:07 ` Huacai Chen
2022-09-22 12:50 ` Ard Biesheuvel
2022-09-22 12:57 ` Ard Biesheuvel
2022-09-22 13:08 ` Huacai Chen
2022-09-22 13:10 ` Ard Biesheuvel
2022-09-22 13:12 ` Huacai Chen
2022-09-22 13:18 ` Ard Biesheuvel
2022-09-22 13:19 ` Ard Biesheuvel
2022-09-22 13:51 ` Ard Biesheuvel
2022-09-22 14:48 ` Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220920183554.3870247-5-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=chenhuacai@loongson.cn \
--cc=ilias.apalodimas@linaro.org \
--cc=linux-efi@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=xry111@xry111.site \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.