]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwWorkSpace.c
Clean up the following module msa files, they are edkmodule package ftwlit, Crc32Sect...
[mirror_edk2.git] / EdkModulePkg / Universal / FirmwareVolume / FaultTolerantWriteLite / Dxe / FtwWorkSpace.c
index 40e56ad1fb155f674e8f6d15725f2c04634f510f..00d7d8e912cf5c62691578fb8c2974fb467b25e5 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \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
@@ -417,17 +417,11 @@ Returns:
   // Read all original data from working block to a memory buffer\r
   //\r
   TempBufferSize = FtwLiteDevice->SpareAreaLength;\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  TempBufferSize,\r
-                  (VOID **) &TempBuffer\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
+  TempBuffer     = AllocateZeroPool (TempBufferSize);\r
+  if (TempBuffer != NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  ZeroMem (TempBuffer, TempBufferSize);\r
-\r
   Ptr = TempBuffer;\r
   for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {\r
     Length = FtwLiteDevice->SizeOfSpareBlock;\r
@@ -439,7 +433,7 @@ Returns:
                                           Ptr\r
                                           );\r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (TempBuffer);\r
+      FreePool (TempBuffer);\r
       return EFI_ABORTED;\r
     }\r
 \r
@@ -450,8 +444,8 @@ Returns:
   //\r
   Ptr = TempBuffer +\r
     ((UINTN) (FtwLiteDevice->FtwWorkSpaceLba - FtwLiteDevice->FtwWorkBlockLba)) *\r
-    FtwLiteDevice->SizeOfSpareBlock +\r
-    FtwLiteDevice->FtwWorkSpaceBase;\r
+    FtwLiteDevice->SizeOfSpareBlock + FtwLiteDevice->FtwWorkSpaceBase;\r
+\r
   Status = CleanupWorkSpace (\r
             FtwLiteDevice,\r
             Ptr,\r
@@ -480,7 +474,7 @@ Returns:
   SpareBufferSize = FtwLiteDevice->SpareAreaLength;\r
   SpareBuffer     = AllocatePool (SpareBufferSize);\r
   if (SpareBuffer == NULL) {\r
-    gBS->FreePool (TempBuffer);\r
+    FreePool (TempBuffer);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -495,8 +489,8 @@ Returns:
                                             Ptr\r
                                             );\r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (TempBuffer);\r
-      gBS->FreePool (SpareBuffer);\r
+      FreePool (TempBuffer);\r
+      FreePool (SpareBuffer);\r
       return EFI_ABORTED;\r
     }\r
 \r
@@ -517,8 +511,8 @@ Returns:
                                             Ptr\r
                                             );\r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (TempBuffer);\r
-      gBS->FreePool (SpareBuffer);\r
+      FreePool (TempBuffer);\r
+      FreePool (SpareBuffer);\r
       return EFI_ABORTED;\r
     }\r
 \r
@@ -527,14 +521,14 @@ Returns:
   //\r
   // Free TempBuffer\r
   //\r
-  gBS->FreePool (TempBuffer);\r
+  FreePool (TempBuffer);\r
 \r
   //\r
   // Write the spare block to working block\r
   //\r
   Status = FlushSpareBlockToWorkingBlock (FtwLiteDevice);\r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (SpareBuffer);\r
+    FreePool (SpareBuffer);\r
     return Status;\r
   }\r
   //\r
@@ -552,14 +546,14 @@ Returns:
                                             Ptr\r
                                             );\r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (SpareBuffer);\r
+      FreePool (SpareBuffer);\r
       return EFI_ABORTED;\r
     }\r
 \r
     Ptr += Length;\r
   }\r
 \r
-  gBS->FreePool (SpareBuffer);\r
+  FreePool (SpareBuffer);\r
 \r
   DEBUG ((EFI_D_FTW_LITE, "FtwLite: reclaim work space success\n"));\r
 \r