]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: simplify try_load_entry()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 25 Apr 2022 21:35:01 +0000 (23:35 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 29 Apr 2022 12:25:39 +0000 (14:25 +0200)
Use function efi_create_indexed_name() to create the BootXXXX variable
name.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_bootmgr.c

index d1c14f1bbc69b7fd5fa732e8c25ea78d64d2dcaf..52bea4d5411ef26dd10957241c82af2f9d7014e1 100644 (file)
@@ -46,16 +46,12 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
                                   void **load_options)
 {
        struct efi_load_option lo;
-       u16 varname[] = u"Boot0000";
-       u16 hexmap[] = u"0123456789ABCDEF";
+       u16 varname[9];
        void *load_option;
        efi_uintn_t size;
        efi_status_t ret;
 
-       varname[4] = hexmap[(n & 0xf000) >> 12];
-       varname[5] = hexmap[(n & 0x0f00) >> 8];
-       varname[6] = hexmap[(n & 0x00f0) >> 4];
-       varname[7] = hexmap[(n & 0x000f) >> 0];
+       efi_create_indexed_name(varname, sizeof(varname), "Boot", n);
 
        load_option = efi_get_var(varname, &efi_global_variable_guid, &size);
        if (!load_option)