]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeServicesLib/DxeServicesLib.c
MdePkg: fix mixed dos and linux EOL format issue
[mirror_edk2.git] / MdePkg / Library / DxeServicesLib / DxeServicesLib.c
index d8e6b5cc4e404ccd86fa663d04fdeb9e860d0353..ef7c9ba9b288f393093d593ce13404bc4e05ce27 100644 (file)
@@ -2,7 +2,7 @@
   MDE DXE Services Library provides functions that simplify the development of DXE Drivers.  \r
   These functions help access data from sections of FFS files or from file path.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -578,7 +578,7 @@ GetSectionFromFfs (
   \r
   Allocate memory to store the found image. The caller is responsible to free memory.\r
 \r
-  If File is NULL, then NULL is returned.\r
+  If FilePath is NULL, then NULL is returned.\r
   If FileSize is NULL, then NULL is returned.\r
   If AuthenticationStatus is NULL, then NULL is returned.\r
 \r
@@ -592,10 +592,9 @@ GetSectionFromFfs (
                                         that is absracted to the file buffer.\r
   @param[out]      FileSize             The pointer to the size of the abstracted \r
                                         file buffer.\r
-  @param[out]      AuthenticationStatus The pointer to a caller-allocated UINT32 \r
-                                        in which the authentication status is returned.\r
+  @param[out]      AuthenticationStatus Pointer to the authentication status.\r
 \r
-  @retval NULL   File is NULL, or FileSize is NULL. Or, the file can't be found.\r
+  @retval NULL   FilePath is NULL, or FileSize is NULL, or AuthenticationStatus is NULL, or the file can't be found.\r
   @retval other  The abstracted file buffer. The caller is responsible to free memory.\r
 **/\r
 VOID *\r
@@ -704,7 +703,9 @@ GetFileBufferByFilePath (
         }\r
       }\r
     }\r
-    goto Finish;\r
+    if (!EFI_ERROR (Status)) {\r
+      goto Finish;\r
+    }\r
   }\r
 \r
   //\r
@@ -728,8 +729,11 @@ GetFileBufferByFilePath (
         TempDevicePathNode = DuplicateDevicePath (DevicePathNode);\r
         if (TempDevicePathNode == NULL) {\r
           FileHandle->Close (FileHandle);\r
+          //\r
+          // Setting Status to an EFI_ERROR value will cause the rest of\r
+          // the file system support below to be skipped.\r
+          //\r
           Status = EFI_OUT_OF_RESOURCES;\r
-          goto Finish;\r
         }\r
         //\r
         // Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the\r
@@ -737,7 +741,7 @@ GetFileBufferByFilePath (
         // our way down each device path node and close the previous node\r
         //\r
         DevicePathNode = TempDevicePathNode;\r
-        while (!IsDevicePathEnd (DevicePathNode) && !EFI_ERROR (Status)) {\r
+        while (!EFI_ERROR (Status) && !IsDevicePathEnd (DevicePathNode)) {\r
           if (DevicePathType (DevicePathNode) != MEDIA_DEVICE_PATH ||\r
               DevicePathSubType (DevicePathNode) != MEDIA_FILEPATH_DP) {\r
             Status = EFI_UNSUPPORTED;\r
@@ -816,10 +820,14 @@ GetFileBufferByFilePath (
         if (FileHandle != NULL) {\r
           FileHandle->Close (FileHandle);\r
         }\r
-        FreePool (TempDevicePathNode);\r
+        if (TempDevicePathNode != NULL) {\r
+          FreePool (TempDevicePathNode);\r
+        }\r
       }\r
     }\r
-    goto Finish;\r
+    if (!EFI_ERROR (Status)) {\r
+      goto Finish;\r
+    }\r
   }\r
 \r
   //\r
@@ -858,7 +866,9 @@ GetFileBufferByFilePath (
           }\r
         }\r
       }\r
-      goto Finish;\r
+      if (!EFI_ERROR (Status)) {\r
+        goto Finish;\r
+      }\r
     }\r
   }\r
 \r