All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Raymond Mao <raymond.mao@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Simon Glass <sjg@chromium.org>,
	Masahisa Kojima <masahisa.kojima@linaro.org>
Subject: Re: [PATCH v7 2/4] Fix incorrect return code of boot option update
Date: Tue, 6 Jun 2023 16:36:19 +0300	[thread overview]
Message-ID: <ZH82U34s9kBZkcci@hera> (raw)
In-Reply-To: <20230531174515.41758-3-raymond.mao@linaro.org>

On Wed, May 31, 2023 at 10:45:15AM -0700, Raymond Mao wrote:
> Correct the return code for out-of-memory and no boot option found
>
> Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> ---
> Changes in v7
> - new patch file created
>
>  cmd/bootmenu.c               | 2 +-
>  cmd/eficonfig.c              | 2 +-
>  lib/efi_loader/efi_bootmgr.c | 8 ++++++--
>  3 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
> index 01daddca7b..987b16889f 100644
> --- a/cmd/bootmenu.c
> +++ b/cmd/bootmenu.c
> @@ -352,7 +352,7 @@ static struct bootmenu_data *bootmenu_create(int delay)
>  		 * a architecture-specific default image name such as BOOTAA64.EFI.
>  		 */
>  		efi_ret = efi_bootmgr_update_media_device_boot_option();
> -		if (efi_ret != EFI_SUCCESS && efi_ret != EFI_NOT_FOUND)
> +		if (efi_ret != EFI_SUCCESS)
>  			goto cleanup;
>
>  		ret = prepare_uefi_bootorder_entry(menu, &iter, &i);
> diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> index 82a80306f4..e6e8a0a488 100644
> --- a/cmd/eficonfig.c
> +++ b/cmd/eficonfig.c
> @@ -2314,7 +2314,7 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
>  		return CMD_RET_FAILURE;
>
>  	ret = efi_bootmgr_update_media_device_boot_option();
> -	if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND)
> +	if (ret != EFI_SUCCESS)
>  		return ret;
>
>  	while (1) {
> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
> index 48cd5f0636..95559ad6dd 100644
> --- a/lib/efi_loader/efi_bootmgr.c
> +++ b/lib/efi_loader/efi_bootmgr.c
> @@ -663,11 +663,13 @@ efi_status_t efi_bootmgr_update_media_device_boot_option(void)
>  					   NULL, &count,
>  					   (efi_handle_t **)&volume_handles);
>  	if (ret != EFI_SUCCESS)
> -		return ret;
> +		goto out;
>
>  	opt = calloc(count, sizeof(struct eficonfig_media_boot_option));
> -	if (!opt)
> +	if (!opt) {
> +		ret = EFI_OUT_OF_RESOURCES;
>  		goto out;
> +	}
>
>  	/* enumerate all devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL */
>  	ret = efi_bootmgr_enumerate_boot_option(opt, volume_handles, count);
> @@ -720,5 +722,7 @@ out:
>  	free(opt);
>  	efi_free_pool(volume_handles);
>
> +	if (ret == EFI_NOT_FOUND)
> +		return EFI_SUCCESS;
>  	return ret;
>  }
> --
> 2.25.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


      parent reply	other threads:[~2023-06-06 13:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230531174515.41758-1-raymond.mao@linaro.org>
     [not found] ` <20230531174515.41758-5-raymond.mao@linaro.org>
2023-06-01  7:20   ` [PATCH v7 4/4] Load option with short device path for boot vars Ilias Apalodimas
     [not found] ` <20230531174515.41758-2-raymond.mao@linaro.org>
2023-06-06  8:13   ` [PATCH v7 1/4] Move bootorder and bootoption apis to lib Heinrich Schuchardt
2023-06-06 14:39     ` Raymond Mao
2023-06-06 15:12       ` Heinrich Schuchardt
2023-06-06 13:37   ` Ilias Apalodimas
     [not found] ` <20230531174515.41758-4-raymond.mao@linaro.org>
2023-06-06 12:06   ` [PATCH v7 3/4] Boot var automatic management for removable medias Ilias Apalodimas
2023-06-06 14:42     ` Raymond Mao
     [not found] ` <20230531174515.41758-3-raymond.mao@linaro.org>
2023-06-06 13:36   ` Ilias Apalodimas [this message]

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=ZH82U34s9kBZkcci@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=masahisa.kojima@linaro.org \
    --cc=raymond.mao@linaro.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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.