These are the common Fault Tolerant Write (FTW) functions that are shared \r
by DXE FTW driver and SMM FTW driver.\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
// Do not assume Spare Block and Target Block have same block size\r
//\r
Status = FtwEraseSpareBlock (FtwDevice);\r
+ if (EFI_ERROR (Status)) {\r
+ FreePool (MyBuffer);\r
+ FreePool (SpareBuffer);\r
+ return EFI_ABORTED;\r
+ }\r
Ptr = MyBuffer;\r
for (Index = 0; MyBufferSize > 0; Index += 1) {\r
if (MyBufferSize > FtwDevice->SpareBlockSize) {\r
// 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
MyLength = FtwDevice->SpareBlockSize;\r
// Erase Spare block\r
// This is restart, no need to keep spareblock content.\r
//\r
- FtwEraseSpareBlock (FtwDevice);\r
+ Status = FtwEraseSpareBlock (FtwDevice);\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_ABORTED;\r
+ }\r
\r
DEBUG ((EFI_D_ERROR, "Ftw: Restart() success \n"));\r
return EFI_SUCCESS;\r