[RFC 01/14] efi_loader: pass GUID by address to efi_dp_from_lo
Ilias Apalodimas
ilias.apalodimas at linaro.org
Sat Apr 27 01:50:58 CEST 2024
On Fri, 26 Apr 2024 at 17:13, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> We should not pass GUIDs by value as this requires copying.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> include/efi_loader.h | 2 +-
> lib/efi_loader/efi_helper.c | 4 ++--
> lib/efi_loader/efi_load_initrd.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 69442f4e58d..9600941aa32 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -743,7 +743,7 @@ efi_status_t EFIAPI efi_register_protocol_notify(const efi_guid_t *protocol,
> efi_status_t efi_file_size(struct efi_file_handle *fh, efi_uintn_t *size);
>
> /* get a device path from a Boot#### option */
> -struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid);
> +struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid);
>
> /* get len, string (used in u-boot crypto from a guid */
> const char *guid_to_sha_str(const efi_guid_t *guid);
> diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
> index 6918fd5e48a..c5d13c0f19c 100644
> --- a/lib/efi_loader/efi_helper.c
> +++ b/lib/efi_loader/efi_helper.c
> @@ -72,7 +72,7 @@ out:
> *
> * Return: device path or NULL. Caller must free the returned value
> */
> -struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid)
> +struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid)
> {
> struct efi_load_option lo;
> void *var_value;
> @@ -92,7 +92,7 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid)
> if (ret != EFI_SUCCESS)
> goto err;
>
> - return efi_dp_from_lo(&lo, &guid);
> + return efi_dp_from_lo(&lo, guid);
>
> err:
> free(var_value);
> diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c
> index 67d1f75d525..d91135436c4 100644
> --- a/lib/efi_loader/efi_load_initrd.c
> +++ b/lib/efi_loader/efi_load_initrd.c
> @@ -63,7 +63,7 @@ static efi_status_t get_initrd_fp(struct efi_device_path **initrd_fp)
> * We can then use this specific return value and not install the
> * protocol, while allowing the boot to continue
> */
> - dp = efi_get_dp_from_boot(efi_lf2_initrd_guid);
> + dp = efi_get_dp_from_boot(&efi_lf2_initrd_guid);
> if (!dp)
> return EFI_INVALID_PARAMETER;
>
> --
> 2.43.0
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
More information about the U-Boot
mailing list