]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.c
1. Use MemoryAllocationLib to replace boot services memory services functions in...
[mirror_edk2.git] / EdkModulePkg / Universal / ConPlatform / Dxe / ConPlatform.c
index 9e8dbbee7b878c0ee4cd6425b2f4f45e3db72fc9..15e7693d1d9eea99bca83d4b6007f2f91d8b904c 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
     ConPlatform.c\r
-    \r
+\r
 Abstract:\r
 \r
 --*/\r
@@ -47,7 +47,7 @@ ConPlatformTextInDriverBindingSupported (
 /*++\r
 \r
 Routine Description:\r
-  Supported \r
+  Supported\r
 \r
 Arguments:\r
   (Standard DriverBinding Protocol Supported() function)\r
@@ -76,7 +76,7 @@ ConPlatformTextOutDriverBindingSupported (
 /*++\r
 \r
 Routine Description:\r
-  Supported \r
+  Supported\r
 \r
 Arguments:\r
   (Standard DriverBinding Protocol Supported() function)\r
@@ -105,7 +105,7 @@ ConPlatformDriverBindingSupported (
 /*++\r
 \r
 Routine Description:\r
-  Supported \r
+  Supported\r
 \r
 Arguments:\r
   (Standard DriverBinding Protocol Supported() function)\r
@@ -551,7 +551,7 @@ Returns:
   Caller is repsoncible freeing the buffer.\r
 \r
   NULL - Variable was not read\r
-  \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -576,8 +576,8 @@ Returns:
     //\r
     // Allocate the buffer to return\r
     //\r
-    Status = gBS->AllocatePool (EfiBootServicesData, BufferSize, &Buffer);\r
-    if (EFI_ERROR (Status)) {\r
+    Buffer = AllocatePool (BufferSize);\r
+    if (Buffer == NULL) {\r
       return NULL;\r
     }\r
     //\r
@@ -591,7 +591,7 @@ Returns:
                     Buffer\r
                     );\r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (Buffer);\r
+      FreePool (Buffer);\r
       Buffer = NULL;\r
     }\r
   }\r
@@ -616,18 +616,18 @@ Arguments:
   Multi        - A pointer to a multi-instance device path data structure.\r
 \r
   Single       - A pointer to a single-instance device path data structure.\r
-  \r
+\r
   NewDevicePath - If Delete is TRUE, this parameter must not be null, and it\r
-                  points to the remaining device path data structure. \r
+                  points to the remaining device path data structure.\r
                   (remaining device path = Multi - Single.)\r
-  \r
+\r
   Delete        - If TRUE, means removing Single from Multi.\r
-                  If FALSE, the routine just check whether Single matches \r
+                  If FALSE, the routine just check whether Single matches\r
                   with any instance in Multi.\r
 \r
 Returns:\r
 \r
-  The function returns EFI_SUCCESS if the Single is contained within Multi.  \r
+  The function returns EFI_SUCCESS if the Single is contained within Multi.\r
   Otherwise, EFI_NOT_FOUND is returned.\r
 \r
 --*/\r
@@ -658,7 +658,7 @@ Returns:
   while (DevicePathInst) {\r
     if (CompareMem (Single, DevicePathInst, Size) == 0) {\r
       if (!Delete) {\r
-        gBS->FreePool (DevicePathInst);\r
+        FreePool (DevicePathInst);\r
         return EFI_SUCCESS;\r
       }\r
     } else {\r
@@ -667,12 +667,14 @@ Returns:
                             TempDevicePath1,\r
                             DevicePathInst\r
                             );\r
-        gBS->FreePool (TempDevicePath1);\r
+        if (TempDevicePath1 != NULL) {\r
+          FreePool (TempDevicePath1);\r
+        }\r
         TempDevicePath1 = TempDevicePath2;\r
       }\r
     }\r
 \r
-    gBS->FreePool (DevicePathInst);\r
+    FreePool (DevicePathInst);\r
     DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);\r
   }\r
 \r
@@ -693,7 +695,7 @@ ConPlatformUpdateDeviceVariable (
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
 \r
 Arguments:\r
 \r
@@ -730,7 +732,9 @@ Returns:
       //\r
       // The device path is already in the variable\r
       //\r
-      gBS->FreePool (VariableDevicePath);\r
+      if (VariableDevicePath != NULL) {\r
+        FreePool (VariableDevicePath);\r
+      }\r
 \r
       return Status;\r
     }\r
@@ -760,7 +764,9 @@ Returns:
               );\r
   }\r
 \r
-  gBS->FreePool (VariableDevicePath);\r
+  if (VariableDevicePath != NULL) {\r
+    FreePool (VariableDevicePath);\r
+  }\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -774,7 +780,7 @@ Returns:
                   NewVariableDevicePath\r
                   );\r
 \r
-  gBS->FreePool (NewVariableDevicePath);\r
+  FreePool (NewVariableDevicePath);\r
 \r
   return Status;\r
 }\r