From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web09.13696.1628451636086406752 for ; Sun, 08 Aug 2021 12:40:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=O9ZuEqXo; spf=pass (domain: posteo.de, ip: 185.67.36.65, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 89335240029 for ; Sun, 8 Aug 2021 21:40:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1628451634; bh=MCT5C43uhVE4UsAJRraP2FgzA+wuNE0Vv7kCiyJXNsw=; h=From:To:Cc:Subject:Date:From; b=O9ZuEqXoW/ZNPLGA9AcLNd/gDUQdJZCBYgEjroqXZh674Hc/yHsxiK4b66XjaWV67 xEYnYBU6T7Due+G4OQBGXG41HCORnkyfTJYtkrJ1PX3a4fJ+YozC3QiT26IRI5dCrQ ZFPYH+2wo0etVfOejOeY6xGmWNsbKJaHZLmeolvJlMoK6ZTAbRcuXhsPaVwgeplzJ0 NzasRE33r+tIa9xbmq5VjeZVhDlD5MySyRs6Fti8EyEa5jYj+t3dsdfCnx7gODW7Zs /Ey4ZSVKOBJxiENliUMwpiAiYMeVEiDR+IJZv6vpVgYKOGwLzOC74CofIXE86NcjO+ KFfp1mJzMaCdA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GjV1X1FH7z6tmF; Sun, 8 Aug 2021 21:40:32 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Liming Gao , Vitaly Cheptsov Subject: [PATCH] MdeModulePkg/DxeCore: Drop unnecessary pointer indirection Date: Sun, 8 Aug 2021 19:39:41 +0000 Message-Id: <57141c34a0fec63b23fcecb156c4c6db8f008f9e.1628360136.git.mhaeuser@posteo.de> In-Reply-To: <5df11a13422732b9c03c120775a2b4dd0a49182f.1628444003.git.mhaeuser@posteo.de> References: <5df11a13422732b9c03c120775a2b4dd0a49182f.1628444003.git.mhaeuser@posteo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable CoreInitializeGcdServices() takes a pointer-to-pointer for the first HOB. However, it is dereferenced in every operation inside. To mitigate confusion whether or not it can be re-allocated by the callee, remove the unnecessary indirection. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Liming Gao Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 2 +- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 10 +++++----- MdeModulePkg/Core/Dxe/DxeMain.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dx= e/DxeMain/DxeMain.c index db21311f9352..1a8f6b57f356 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -263,7 +263,7 @@ DxeMain ( //=0D // Initialize Memory Services=0D //=0D - CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLeng= th);=0D + CoreInitializeMemoryServices (HobStart, &MemoryBaseAddress, &MemoryLengt= h);=0D =0D MemoryProfileInit (HobStart);=0D =0D diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gc= d.c index 51b082b7e7eb..af9e9e315819 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -2168,7 +2168,7 @@ FindLargestFreeRegion ( **/=0D EFI_STATUS=0D CoreInitializeMemoryServices (=0D - IN VOID **HobStart,=0D + IN VOID *HobStart,=0D OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,=0D OUT UINT64 *MemoryLength=0D )=0D @@ -2194,7 +2194,7 @@ CoreInitializeMemoryServices ( //=0D // Point at the first HOB. This must be the PHIT HOB.=0D //=0D - Hob.Raw =3D *HobStart;=0D + Hob.Raw =3D HobStart;=0D ASSERT (GET_HOB_TYPE (Hob) =3D=3D EFI_HOB_TYPE_HANDOFF);=0D =0D //=0D @@ -2248,7 +2248,7 @@ CoreInitializeMemoryServices ( // Find the Resource Descriptor HOB that contains PHIT range EfiFreeMemo= ryBottom..EfiFreeMemoryTop=0D //=0D Found =3D FALSE;=0D - for (Hob.Raw =3D *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEXT_= HOB(Hob)) {=0D + for (Hob.Raw =3D HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEXT_H= OB(Hob)) {=0D //=0D // Skip all HOBs except Resource Descriptor HOBs=0D //=0D @@ -2304,7 +2304,7 @@ CoreInitializeMemoryServices ( // Compute range between the start of the Resource Descriptor HOB = and the start of the HOB List=0D //=0D BaseAddress =3D PageAlignAddress (ResourceHob->PhysicalStart);=0D - Length =3D PageAlignLength ((UINT64)((UINTN)*HobStart - Base= Address));=0D + Length =3D PageAlignLength ((UINT64)((UINTN)HobStart - BaseA= ddress));=0D FindLargestFreeRegion (&BaseAddress, &Length, (EFI_HOB_MEMORY_ALLO= CATION *)GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION));=0D }=0D }=0D @@ -2329,7 +2329,7 @@ CoreInitializeMemoryServices ( // The max address must be within the physically addressible range for= the processor.=0D //=0D HighAddress =3D MAX_ALLOC_ADDRESS;=0D - for (Hob.Raw =3D *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEX= T_HOB(Hob)) {=0D + for (Hob.Raw =3D HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEXT= _HOB(Hob)) {=0D //=0D // Skip the Resource Descriptor HOB that contains the PHIT=0D //=0D diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMai= n.h index 9bd3c0d08411..8f268dd2854a 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -366,7 +366,7 @@ CoreAcquireGcdMemoryLock ( **/=0D EFI_STATUS=0D CoreInitializeMemoryServices (=0D - IN VOID **HobStart,=0D + IN VOID *HobStart,=0D OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,=0D OUT UINT64 *MemoryLength=0D );=0D --=20 2.31.1