eficonfig: avoid SetVariable between GetNextVariableName calls
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Mon, 19 Dec 2022 02:33:13 +0000 (11:33 +0900)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 20 Dec 2022 15:06:48 +0000 (16:06 +0100)
commit645502743ac10ffaa5abf944bf0b751b32b47220
tree20f2d03a1cf5e5f145f7ed3c933a52b81f43a065
parentce3270849ba2e8449ca5e70d40cd752ba7a13b63
eficonfig: avoid SetVariable between GetNextVariableName calls

The current code calls efi_set_variable_int() to delete the
invalid boot option between calls to efi_get_next_variable_name_int(),
it may produce unpredictable results.

This commit moves removal of the invalid boot option outside
of the efi_get_next_variable_name_int() calls.
EFI_NOT_FOUND returned from efi_get_next_variable_name_int()
indicates we retrieved all EFI variables, it should be treated
as EFI_SUCEESS.

To address the checkpatch warning of too many leading tabs,
combine two if statement into one.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
cmd/eficonfig.c