]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: simplify efi_str_to_u16()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 19 Mar 2023 08:20:23 +0000 (09:20 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 25 Mar 2023 10:06:35 +0000 (11:06 +0100)
Use efi_alloc() to allocate memory.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
lib/efi_loader/efi_device_path_to_text.c

index 4b2ade3803fa41da3167eebd19198f22082b17f8..8c76d8be605d8ff290e01898f5702456c0edc6a5 100644 (file)
@@ -32,11 +32,10 @@ static u16 *efi_str_to_u16(char *str)
 {
        efi_uintn_t len;
        u16 *out, *dst;
-       efi_status_t ret;
 
        len = sizeof(u16) * (utf8_utf16_strlen(str) + 1);
-       ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, len, (void **)&out);
-       if (ret != EFI_SUCCESS)
+       out = efi_alloc(len);
+       if (!out)
                return NULL;
        dst = out;
        utf8_utf16_strcpy(&dst, str);