From patchwork Fri Mar 27 05:27:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 244394 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Fri, 27 Mar 2020 06:27:50 +0100 Subject: [PATCH 06/16] efi_loader: keep attributes in efi_set_variable_int() In-Reply-To: <20200327052800.11022-1-xypron.glpk@gmx.de> References: <20200327052800.11022-1-xypron.glpk@gmx.de> Message-ID: <20200327052800.11022-7-xypron.glpk@gmx.de> Do not change the value of parameter attributes in function efi_set_variable_int(). This allows to use it later. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_variable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 4fae1fa4c7..d99ad6ddae 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -573,8 +573,8 @@ efi_status_t efi_set_variable_int(u16 *variable_name, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS); s += sprintf(s, "{"); - while (attributes) { - u32 attr = 1 << (ffs(attributes) - 1); + for (u32 attr_rem = attributes; attr_rem;) { + u32 attr = 1 << (ffs(attr_rem) - 1); if (attr == EFI_VARIABLE_NON_VOLATILE) s += sprintf(s, "nv"); @@ -583,8 +583,8 @@ efi_status_t efi_set_variable_int(u16 *variable_name, else if (attr == EFI_VARIABLE_RUNTIME_ACCESS) s += sprintf(s, "run"); - attributes &= ~attr; - if (attributes) + attr_rem &= ~attr; + if (attr_rem) s += sprintf(s, ","); } s += sprintf(s, "}");