IntelFspPkg: Remove the const condition if statement to refine the code.
authorQiu Shumin <shumin.qiu@intel.com>
Mon, 3 Aug 2015 02:59:55 +0000 (02:59 +0000)
committershenshushi <shenshushi@Edk2>
Mon, 3 Aug 2015 02:59:55 +0000 (02:59 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: "Yao, Jiewen" <Jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18124 6f19259b-4bc3-4df7-8a09-765794883524

IntelFspPkg/FspDxeIpl/DxeIpl.c

index f6e1116..9ccd3ca 100644 (file)
@@ -301,67 +301,58 @@ Decompress (
   //\r
   switch (CompressionType) {\r
   case EFI_STANDARD_COMPRESSION:\r
-    if (TRUE) {\r
-      //\r
-      // Load EFI standard compression.\r
-      // For compressed data, decompress them to destination buffer.\r
-      //\r
-      Status = UefiDecompressGetInfo (\r
-                 CompressionSource,\r
-                 CompressionSourceSize,\r
-                 &DstBufferSize,\r
-                 &ScratchBufferSize\r
-                 );\r
-      if (EFI_ERROR (Status)) {\r
-        //\r
-        // GetInfo failed\r
-        //\r
-        DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));\r
-        return EFI_NOT_FOUND;\r
-      }\r
-      //\r
-      // Allocate scratch buffer\r
-      //\r
-      ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));\r
-      if (ScratchBuffer == NULL) {\r
-        return EFI_OUT_OF_RESOURCES;\r
-      }\r
-      //\r
-      // Allocate destination buffer, extra one page for adjustment\r
-      //\r
-      DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);\r
-      if (DstBuffer == NULL) {\r
-        return EFI_OUT_OF_RESOURCES;\r
-      }\r
-      //\r
-      // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header\r
-      // to make section data at page alignment.\r
-      //\r
-      DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);\r
+    //\r
+    // Load EFI standard compression.\r
+    // For compressed data, decompress them to destination buffer.\r
+    //\r
+    Status = UefiDecompressGetInfo (\r
+               CompressionSource,\r
+               CompressionSourceSize,\r
+               &DstBufferSize,\r
+               &ScratchBufferSize\r
+               );\r
+    if (EFI_ERROR (Status)) {\r
       //\r
-      // Call decompress function\r
+      // GetInfo failed\r
       //\r
-      Status = UefiDecompress (\r
-                  CompressionSource,\r
-                  DstBuffer,\r
-                  ScratchBuffer\r
-                  );\r
-      if (EFI_ERROR (Status)) {\r
-        //\r
-        // Decompress failed\r
-        //\r
-        DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));\r
-        return EFI_NOT_FOUND;\r
-      }\r
-      break;\r
-    } else {\r
+      DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));\r
+      return EFI_NOT_FOUND;\r
+    }\r
+    //\r
+    // Allocate scratch buffer\r
+    //\r
+    ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));\r
+    if (ScratchBuffer == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+    //\r
+    // Allocate destination buffer, extra one page for adjustment\r
+    //\r
+    DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);\r
+    if (DstBuffer == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+    //\r
+    // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header\r
+    // to make section data at page alignment.\r
+    //\r
+    DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);\r
+    //\r
+    // Call decompress function\r
+    //\r
+    Status = UefiDecompress (\r
+                CompressionSource,\r
+                DstBuffer,\r
+                ScratchBuffer\r
+                );\r
+    if (EFI_ERROR (Status)) {\r
       //\r
-      // PcdDxeIplSupportUefiDecompress is FALSE\r
-      // Don't support UEFI decompression algorithm.\r
+      // Decompress failed\r
       //\r
-      ASSERT (FALSE);\r
+      DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));\r
       return EFI_NOT_FOUND;\r
     }\r
+    break;\r
 \r
   case EFI_NOT_COMPRESSED:\r
     //\r