[PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing

Etienne Carriere etienne.carriere at linaro.org
Thu Jan 19 12:16:58 CET 2023


On Wed, 18 Jan 2023 at 17:12, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> When we try to load EFI variables from a file in the ESP partition and the
> file is missing We print a scary error looking like
> => printenv -e
> ** Unable to read file ubootefi.var **
> Failed to load EFI variables
>
> This is not an error though since the file wasn't there to begin with.
> So silence the warning by aborting the load if the file is not there,
> instead of failing the load.
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
>  lib/efi_loader/efi_var_file.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
> index 62e071bd8341..7d7141473634 100644
> --- a/lib/efi_loader/efi_var_file.c
> +++ b/lib/efi_loader/efi_var_file.c
> @@ -223,6 +223,12 @@ efi_status_t efi_var_from_file(void)
>                 return EFI_OUT_OF_RESOURCES;
>         }
>
> +       ret = efi_set_blk_dev_to_system_partition();
> +       if (ret != EFI_SUCCESS)
> +               goto error;
> +       if (!fs_exists(EFI_VAR_FILE_NAME))
> +               goto error;
> +
>         ret = efi_set_blk_dev_to_system_partition();
>         if (ret != EFI_SUCCESS)
>                 goto error;

This later call to efi_set_blk_dev_to_system_partition() can be
removed since already done above.

Etienne

> --
> 2.38.1
>


More information about the U-Boot mailing list