* [PATCH 1/1] efi/libstub: simplify efi_get_memory_map()
@ 2020-02-16 18:40 Heinrich Schuchardt
2020-02-17 8:37 ` Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2020-02-16 18:40 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: linux-efi, linux-kernel, Heinrich Schuchardt
Do not check the value of status twice.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/firmware/efi/libstub/mem.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/firmware/efi/libstub/mem.c b/drivers/firmware/efi/libstub/mem.c
index c6a784ed640f..c25fd9174b74 100644
--- a/drivers/firmware/efi/libstub/mem.c
+++ b/drivers/firmware/efi/libstub/mem.c
@@ -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;
--
2.25.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] efi/libstub: simplify efi_get_memory_map()
2020-02-16 18:40 [PATCH 1/1] efi/libstub: simplify efi_get_memory_map() Heinrich Schuchardt
@ 2020-02-17 8:37 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2020-02-17 8:37 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: linux-efi, Linux Kernel Mailing List
On Sun, 16 Feb 2020 at 19:40, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Do not check the value of status twice.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Thanks, I'll queue this one as well.
> ---
> drivers/firmware/efi/libstub/mem.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/mem.c b/drivers/firmware/efi/libstub/mem.c
> index c6a784ed640f..c25fd9174b74 100644
> --- a/drivers/firmware/efi/libstub/mem.c
> +++ b/drivers/firmware/efi/libstub/mem.c
> @@ -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;
> --
> 2.25.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-17 8:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-16 18:40 [PATCH 1/1] efi/libstub: simplify efi_get_memory_map() Heinrich Schuchardt
2020-02-17 8:37 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).