]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
MdeModulePkg: FaultTolerantWriteDxe: mellow DEBUGs about workspace reinit
[mirror_edk2.git] / MdeModulePkg / Universal / FaultTolerantWriteDxe / UpdateWorkingBlock.c
index f3e6eac5d2e30ef0b099d3efbf8cebbbb3efe2e0..d46a37fde3f4e56ec3a78d24a5b0d78649195e25 100644 (file)
@@ -2,7 +2,7 @@
 \r
    Internal functions to operate Working Block Space.\r
 \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, 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
@@ -98,7 +98,7 @@ IsValidWorkSpace (
     return TRUE;\r
   }\r
 \r
-  DEBUG ((EFI_D_ERROR, "Ftw: Work block header check error\n"));\r
+  DEBUG ((EFI_D_INFO, "Ftw: Work block header check mismatch\n"));\r
   return FALSE;\r
 }\r
 \r
@@ -510,6 +510,11 @@ FtwReclaimWorkSpace (
   // Write the memory buffer to spare block\r
   //\r
   Status  = FtwEraseSpareBlock (FtwDevice);\r
+  if (EFI_ERROR (Status)) {\r
+    FreePool (TempBuffer);\r
+    FreePool (SpareBuffer);\r
+    return EFI_ABORTED;\r
+  }\r
   Ptr     = TempBuffer;\r
   for (Index = 0; TempBufferSize > 0; Index += 1) {\r
     if (TempBufferSize > FtwDevice->SpareBlockSize) {\r
@@ -584,6 +589,10 @@ FtwReclaimWorkSpace (
   // Restore spare backup buffer into spare block , if no failure happened during FtwWrite.\r
   //\r
   Status  = FtwEraseSpareBlock (FtwDevice);\r
+  if (EFI_ERROR (Status)) {\r
+    FreePool (SpareBuffer);\r
+    return EFI_ABORTED;\r
+  }\r
   Ptr     = SpareBuffer;\r
   for (Index = 0; Index < FtwDevice->NumberOfSpareBlock; Index += 1) {\r
     Length = FtwDevice->SpareBlockSize;\r