diff options
author | Abhishek Shah <quic_abhshah@quicinc.com> | 2021-12-30 23:58:49 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2022-03-03 01:23:34 -0800 |
commit | 02e009d45c78fb144c454ae25b98eb565a38caa4 (patch) | |
tree | d8e34d208b878382669ebf57143cac533a472beb | |
parent | 933669baf1348ebef356f3e52841e38e3b92bead (diff) |
QcomModulePkg: Perform revision check before using GetDDRMappedRegions
Perform revision check in GetDDrRegionsInfo() before making use of
pDDrGetInfoProtocol->GetDDRMappedRegions() since this callback is not
implemented for older revision of the protocol and using it results
in crash.
Removed the protocol revision check against DDR_DETAILS_STRUCT_VERSION
done after GetDDRMappedRegions() to avoid repetition.
Change-Id: Ic3d7287181b64f0826f59978dff0808c8ddf57dd
-rw-r--r-- | QcomModulePkg/Library/BootLib/UpdateDeviceTree.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c b/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c index 9948c961da..f573006726 100644 --- a/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c +++ b/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c @@ -682,6 +682,15 @@ GetDDrRegionsInfo (struct ddr_regions_data_info *DdrRegionsInfo) return Status; } + Revision = pDDrGetInfoProtocol->Revision; + DEBUG ((EFI_D_VERBOSE, "DDR Header Revision =0x%x\n", Revision)); + + if (Revision < EFI_DDRGETINFO_PROTOCOL_REVISION) { + DEBUG ((EFI_D_VERBOSE, + "GetDDRMappedRegions not supported in Revision=0x%x\n", Revision)); + return EFI_UNSUPPORTED; + } + Status = pDDrGetInfoProtocol->GetDDRMappedRegions (pDDrGetInfoProtocol, DdrRegionsInfo); if ((EFI_SUCCESS != Status) || @@ -691,15 +700,6 @@ GetDDrRegionsInfo (struct ddr_regions_data_info *DdrRegionsInfo) return EFI_OUT_OF_RESOURCES; } - Revision = pDDrGetInfoProtocol->Revision; - DEBUG ((EFI_D_VERBOSE, "DDR Header Revision =0x%x\n", Revision)); - - if (Revision < DDR_DETAILS_STRUCT_VERSION) { - DEBUG ((EFI_D_INFO, - "DDr regions not supported in Revision=0x%x\n", Revision)); - return EFI_UNSUPPORTED; - } - return Status; } |