[PATCH v5 1/3] efi_var_file: refactor to move buffer functions
Michal Simek
michal.simek at amd.com
Fri Jan 30 10:10:47 CET 2026
On 1/30/26 08:39, Ilias Apalodimas wrote:
> Hi Michal,
>
> Thanks for following up on this
>
>
>> * efi_var_restore() - restore EFI variables from buffer
>> *
>> diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
>> index f490081f6542..ca1775eb03be 100644
>> --- a/lib/efi_loader/Makefile
>> +++ b/lib/efi_loader/Makefile
>> @@ -53,7 +53,7 @@ ifeq ($(CONFIG_EFI_MM_COMM_TEE),y)
>> obj-y += efi_variable_tee.o
>> else
>> obj-y += efi_variable.o
>> -obj-y += efi_var_file.o
>> +obj-$(CONFIG_EFI_VARIABLE_FILE_STORE) += efi_var_file.o
>
> hrmm what if we compile with EFI_VARIABLE_NO_STORE?
What's the concern here?
efi_var_to_file/efi_var_from_file() are just defined in efi_var_file.c
But that functions are never called from efi_variable.c
if (attributes & EFI_VARIABLE_NON_VOLATILE) {
if (IS_ENABLED(CONFIG_EFI_VARIABLE_NO_STORE))
return EFI_NOT_READY;
efi_var_to_file();
I mean undefined reference to efi_var_to_file() is there but because there is
return above function is unreachable and compiler just removes it.
>
>> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
>> index f3533f4def3a..13db6eae882a 100644
>> --- a/lib/efi_loader/efi_variable.c
>> +++ b/lib/efi_loader/efi_variable.c
>> @@ -397,11 +397,15 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
>> ret = EFI_SUCCESS;
>>
>> /*
>> - * Write non-volatile EFI variables to file
>> + * Write non-volatile EFI variables
>> * TODO: check if a value change has occured to avoid superfluous writes
>> */
>> - if (attributes & EFI_VARIABLE_NON_VOLATILE)
>> + if (attributes & EFI_VARIABLE_NON_VOLATILE) {
>> + if (IS_ENABLED(CONFIG_EFI_VARIABLE_NO_STORE))
>> + return EFI_NOT_READY;
>
> I think we should just return success here. EFI_VARIABLE_NO_STORE
> means "dont store on file, but we still have to update the memory
> backend.
Yes before this patch EFI_SUCCESS was returned. Will fix.
Thanks,
Michal
More information about the U-Boot
mailing list