[PATCH] expo: allocate correct ammount of memory

Simon Glass sjg at chromium.org
Mon Jul 31 19:07:55 CEST 2023


On Mon, 31 Jul 2023 at 08:08, Dan Carpenter <dan.carpenter at linaro.org> wrote:
>
> This should be allocating the memory for "item" instead of "menu".
> The item struct is 48 bytes instead of 96 (assuming a 64bit system)
> so this saves a little memory.
>
> Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
> ---
>  boot/scene_menu.c | 2 +-
>  1 file changed, 1 insertions(+), 1 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

typo in commit subject


>
> diff --git a/boot/scene_menu.c b/boot/scene_menu.c
> index 8a355f838cc8..57ffb523ff3f 100644
> --- a/boot/scene_menu.c
> +++ b/boot/scene_menu.c
> @@ -416,7 +416,7 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id,
>         if (!scene_obj_find(scn, label_id, SCENEOBJT_TEXT))
>                 return log_msg_ret("txt", -EINVAL);
>
> -       item = calloc(1, sizeof(struct scene_obj_menu));
> +       item = calloc(1, sizeof(struct scene_menitem));
>         if (!item)
>                 return log_msg_ret("item", -ENOMEM);
>         item->name = strdup(name);
> --
> 2.39.2
>


More information about the U-Boot mailing list