[RFC 7/7] efi_loader: use uclass_get_dp_node

Simon Glass sjg at chromium.org
Mon Mar 27 06:00:41 CEST 2023


Hi Heinrich,

On Mon, 27 Mar 2023 at 06:28, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> Use function uclass_get_dp_node() to construct device paths.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
>  lib/efi_loader/efi_device_path.c | 325 +++----------------------------
>  1 file changed, 28 insertions(+), 297 deletions(-)

This is definitely a step in the right direction. Thank you for working on it.

[..]

> +       dp = uclass_get_dp_node(dev);
> +       if (dp) {
> +               memcpy(buf, dp, dp->length);
> +               buf += dp->length;
> +               efi_free_pool(dp);

This suggests that the API should be:

int uclass_get_dp_node(struct xxx *dp)

with it writing the data to the provided pointer address and returning
the number of bytes used. That would avoid the malloc() / free().

>         }
> +
> +       return buf;
>  }
>
>  static unsigned dp_part_size(struct blk_desc *desc, int part)
> --
> 2.39.2
>

Regards,
Simon


More information about the U-Boot mailing list