]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
Optimize the code to not call StrToBuf when DataLength is 0.
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLib / DevicePathFromText.c
index 008ec0b96c7480beb64d1c980c99230e52b5fdf7..37d7a1752b76a67222c1dd641f8cd2c9cf3a91ff 100644 (file)
@@ -567,7 +567,9 @@ DevPathFromTextGenericPath (
            (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + DataLength)\r
            );\r
 \r
-  StrToBuf ((UINT8 *) (Node + 1), DataLength, DataStr);\r
+  if (DataLength != 0) {\r
+    StrToBuf ((UINT8 *) (Node + 1), DataLength, DataStr);\r
+  }\r
   return Node;\r
 }\r
 \r