summaryrefslogtreecommitdiff
path: root/IntelFspPkg
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-08-03 02:59:55 +0000
committershenshushi <shenshushi@Edk2>2015-08-03 02:59:55 +0000
commit496b0dd00c377461bd059c0027ec2437630e2496 (patch)
treec1b7a7e9e4677464633b557c4defdf2468319839 /IntelFspPkg
parentb23441875c34bd15badb76e8d0b001ebd5d7010d (diff)
downloadedk2-platforms-496b0dd00c377461bd059c0027ec2437630e2496.tar.xz
IntelFspPkg: Remove the const condition if statement to refine the code.
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
Diffstat (limited to 'IntelFspPkg')
-rw-r--r--IntelFspPkg/FspDxeIpl/DxeIpl.c101
1 files changed, 46 insertions, 55 deletions
diff --git a/IntelFspPkg/FspDxeIpl/DxeIpl.c b/IntelFspPkg/FspDxeIpl/DxeIpl.c
index f6e1116f57..9ccd3ca94b 100644
--- a/IntelFspPkg/FspDxeIpl/DxeIpl.c
+++ b/IntelFspPkg/FspDxeIpl/DxeIpl.c
@@ -301,67 +301,58 @@ Decompress (
//
switch (CompressionType) {
case EFI_STANDARD_COMPRESSION:
- if (TRUE) {
- //
- // Load EFI standard compression.
- // For compressed data, decompress them to destination buffer.
- //
- Status = UefiDecompressGetInfo (
- CompressionSource,
- CompressionSourceSize,
- &DstBufferSize,
- &ScratchBufferSize
- );
- if (EFI_ERROR (Status)) {
- //
- // GetInfo failed
- //
- DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));
- return EFI_NOT_FOUND;
- }
- //
- // Allocate scratch buffer
- //
- ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));
- if (ScratchBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Allocate destination buffer, extra one page for adjustment
- //
- DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
- if (DstBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header
- // to make section data at page alignment.
- //
- DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);
+ //
+ // Load EFI standard compression.
+ // For compressed data, decompress them to destination buffer.
+ //
+ Status = UefiDecompressGetInfo (
+ CompressionSource,
+ CompressionSourceSize,
+ &DstBufferSize,
+ &ScratchBufferSize
+ );
+ if (EFI_ERROR (Status)) {
//
- // Call decompress function
+ // GetInfo failed
//
- Status = UefiDecompress (
- CompressionSource,
- DstBuffer,
- ScratchBuffer
- );
- if (EFI_ERROR (Status)) {
- //
- // Decompress failed
- //
- DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));
- return EFI_NOT_FOUND;
- }
- break;
- } else {
+ DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));
+ return EFI_NOT_FOUND;
+ }
+ //
+ // Allocate scratch buffer
+ //
+ ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));
+ if (ScratchBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Allocate destination buffer, extra one page for adjustment
+ //
+ DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
+ if (DstBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // DstBuffer still is one section. Adjust DstBuffer offset, skip EFI section header
+ // to make section data at page alignment.
+ //
+ DstBuffer = DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER);
+ //
+ // Call decompress function
+ //
+ Status = UefiDecompress (
+ CompressionSource,
+ DstBuffer,
+ ScratchBuffer
+ );
+ if (EFI_ERROR (Status)) {
//
- // PcdDxeIplSupportUefiDecompress is FALSE
- // Don't support UEFI decompression algorithm.
+ // Decompress failed
//
- ASSERT (FALSE);
+ DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));
return EFI_NOT_FOUND;
}
+ break;
case EFI_NOT_COMPRESSED:
//