Update the control flow to take the same actions for failed fixed-address loading as if the feature was disabled. This primarily removes code duplication.
Cc: Jian J Wang <jian.j.w...@intel.com> Cc: Hao A Wu <hao.a...@intel.com> Cc: Dandan Bi <dandan...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Cc: Debkumar De <debkumar...@intel.com> Cc: Harry Han <harry....@intel.com> Cc: Catharine West <catharine.w...@intel.com> Cc: Vitaly Cheptsov <vit9...@protonmail.com> Signed-off-by: Marvin Häuser <mhaeu...@posteo.de> --- MdeModulePkg/Core/Pei/Image/Image.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index 5af3895191a5..94adbed82e44 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -364,18 +364,18 @@ LoadAndRelocatePeCoffImage ( AlignImageSize += ImageContext.SectionAlignment; } + Status = EFI_UNSUPPORTED; + if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0 && (Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)) { Status = GetPeCoffImageFixLoadingAssignedAddress(&ImageContext, Private); if (EFI_ERROR (Status)){ DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED ERROR: Failed to load module at fixed address. \n")); - // - // The PEIM is not assigned valid address, try to allocate page to load it. - // - Status = PeiServicesAllocatePages (EfiBootServicesCode, - EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize), - &ImageContext.ImageAddress); } - } else { + } + if (EFI_ERROR (Status)){ + // + // The PEIM is not assigned valid address, try to allocate page to load it. + // Status = PeiServicesAllocatePages (EfiBootServicesCode, EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize), &ImageContext.ImageAddress); -- 2.31.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79672): https://edk2.groups.io/g/devel/message/79672 Mute This Topic: https://groups.io/mt/85048609/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-