efi_loader: rearrange boottime service functions
[oweals/u-boot.git] / lib / efi_loader / efi_device_path_to_text.c
index a79e60a4eeae89f4a768f526d3d4c7267f440601..e219f84b28d229924d975a3418e0e904df8b06e8 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *  EFI device path interface
  *
  *  Copyright (c) 2017 Heinrich Schuchardt
- *
- *  SPDX-License-Identifier:     GPL-2.0+
  */
 
 #include <common.h>
 const efi_guid_t efi_guid_device_path_to_text_protocol =
                EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
 
+/**
+ * efi_str_to_u16() - convert ASCII string to UTF-16
+ *
+ * A u16 buffer is allocated from pool. The ASCII string is copied to the u16
+ * buffer.
+ *
+ * @str:       ASCII string
+ * Return:     UTF-16 string. NULL if out of memory.
+ */
 static u16 *efi_str_to_u16(char *str)
 {
        efi_uintn_t len;
@@ -30,7 +38,6 @@ static u16 *efi_str_to_u16(char *str)
        if (ret != EFI_SUCCESS)
                return NULL;
        ascii2unicode(out, str);
-       out[len - 1] = 0;
        return out;
 }
 
@@ -262,9 +269,9 @@ static char *efi_convert_single_device_node_to_text(
  * for details.
  *
  * device_node         device node to be converted
- * display_only                true if the shorter text represenation shall be used
+ * display_only                true if the shorter text representation shall be used
  * allow_shortcuts     true if shortcut forms may be used
- * @return             text represenation of the device path
+ * @return             text representation of the device path
  *                     NULL if out of memory of device_path is NULL
  */
 static uint16_t EFIAPI *efi_convert_device_node_to_text(
@@ -295,9 +302,9 @@ out:
  * for details.
  *
  * device_path         device path to be converted
- * display_only                true if the shorter text represenation shall be used
+ * display_only                true if the shorter text representation shall be used
  * allow_shortcuts     true if shortcut forms may be used
- * @return             text represenation of the device path
+ * @return             text representation of the device path
  *                     NULL if out of memory of device_path is NULL
  */
 static uint16_t EFIAPI *efi_convert_device_path_to_text(