mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-26 05:34:30 +08:00
efi_loader: simplify efi_str_to_u16()
Use efi_alloc() to allocate memory. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
f606fab8da
commit
bace47a59d
@ -32,11 +32,10 @@ static u16 *efi_str_to_u16(char *str)
|
|||||||
{
|
{
|
||||||
efi_uintn_t len;
|
efi_uintn_t len;
|
||||||
u16 *out, *dst;
|
u16 *out, *dst;
|
||||||
efi_status_t ret;
|
|
||||||
|
|
||||||
len = sizeof(u16) * (utf8_utf16_strlen(str) + 1);
|
len = sizeof(u16) * (utf8_utf16_strlen(str) + 1);
|
||||||
ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, len, (void **)&out);
|
out = efi_alloc(len);
|
||||||
if (ret != EFI_SUCCESS)
|
if (!out)
|
||||||
return NULL;
|
return NULL;
|
||||||
dst = out;
|
dst = out;
|
||||||
utf8_utf16_strcpy(&dst, str);
|
utf8_utf16_strcpy(&dst, str);
|
||||||
|
Loading…
Reference in New Issue
Block a user