PrmPkg: Enforce stricter types

Makes the following changes to enforce stricter types:

1. PrmPkg/PrmConfigDxe

   The function PrmConfigEndOfDxeNotification () is used as a notify
   function (of type EFI_EVENT_NOTIFY), however it has a return type
   of EFI_STATUS whereas the return type should actually be VOID.

2. PrmPkg/PrmLoaderDxe

   Updates the following types to be more accurate than were allowed
   in the VS compiler:
   * 3rd actual argument given to GetModuleContextBuffers () is
     explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS **

   * 3rd actual argument given to GetContextBuffer () is
     explicitly marked as CONST PRM_CONTEXT_BUFFER **

   * PrmLoaderEndOfDxeNotification () return type is changed to VOID
     to align with the EFI_EVENT_NOTIFY type

3. PrmPkg/Application/PrmInfo

   Updates the following types to be more accurate than were allowed
   in the VS compiler:
   * SHELL_STATUS in ParseParameterList () is now EFI_STATUS

   * 3rd actual argument given to GetModuleContextBuffers () is
     explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS **

   * 3rd actual argument given to GetContextBuffer () is
     explicitly marked as CONST PRM_CONTEXT_BUFFER **

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
This commit is contained in:
Michael Kubacki 2020-06-16 09:32:38 -07:00 committed by mergify[bot]
parent 4348c72ad0
commit e10c776487
3 changed files with 8 additions and 16 deletions

View File

@ -221,7 +221,7 @@ GatherPrmHandlerInfo (
Status = GetModuleContextBuffers ( Status = GetModuleContextBuffers (
ByModuleGuid, ByModuleGuid,
CurrentModuleGuid, CurrentModuleGuid,
&CurrentModuleContextBuffers (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContextBuffers
); );
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND); ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) { if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {
@ -272,7 +272,7 @@ GatherPrmHandlerInfo (
Status = GetContextBuffer ( Status = GetContextBuffer (
CurrentHandlerContext.Guid, CurrentHandlerContext.Guid,
CurrentModuleContextBuffers, CurrentModuleContextBuffers,
&CurrentContextBuffer (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer
); );
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
CurrentHandlerContext.StaticDataBuffer = CurrentContextBuffer->StaticDataBuffer; CurrentHandlerContext.StaticDataBuffer = CurrentContextBuffer->StaticDataBuffer;
@ -520,7 +520,7 @@ ParseParameterList (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
SHELL_STATUS ReturnStatus; EFI_STATUS ReturnStatus;
UINTN ArgumentCount; UINTN ArgumentCount;
EFI_GUID HandlerGuid; EFI_GUID HandlerGuid;
BOOLEAN PrintHandlerInfo; BOOLEAN PrintHandlerInfo;

View File

@ -361,10 +361,8 @@ PrmConfigVirtualAddressChangeEvent (
@param[in] Context The pointer to the notification function's context, @param[in] Context The pointer to the notification function's context,
which is implementation-dependent. which is implementation-dependent.
@retval EFI_SUCCESS The function executed successfully
**/ **/
EFI_STATUS VOID
EFIAPI EFIAPI
PrmConfigEndOfDxeNotification ( PrmConfigEndOfDxeNotification (
IN EFI_EVENT Event, IN EFI_EVENT Event,
@ -446,8 +444,6 @@ PrmConfigEndOfDxeNotification (
gBS->FreePool (HandleBuffer); gBS->FreePool (HandleBuffer);
} }
gBS->CloseEvent(Event); gBS->CloseEvent(Event);
return EFI_SUCCESS;
} }
/** /**

View File

@ -151,7 +151,7 @@ ProcessPrmModules (
Status = GetModuleContextBuffers ( Status = GetModuleContextBuffers (
ByModuleGuid, ByModuleGuid,
&CurrentModuleInfoStruct->Identifier, &CurrentModuleInfoStruct->Identifier,
&CurrentModuleContextBuffers (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContextBuffers
); );
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND); ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) { if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {
@ -177,7 +177,7 @@ ProcessPrmModules (
Status = GetContextBuffer ( Status = GetContextBuffer (
&CurrentHandlerInfoStruct->Identifier, &CurrentHandlerInfoStruct->Identifier,
CurrentModuleContextBuffers, CurrentModuleContextBuffers,
&CurrentContextBuffer (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer
); );
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
CurrentHandlerInfoStruct->StaticDataBuffer = (UINT64) (UINTN) CurrentContextBuffer->StaticDataBuffer; CurrentHandlerInfoStruct->StaticDataBuffer = (UINT64) (UINTN) CurrentContextBuffer->StaticDataBuffer;
@ -286,10 +286,8 @@ PublishPrmAcpiTable (
@param[in] Context The pointer to the notification function's context, @param[in] Context The pointer to the notification function's context,
which is implementation-dependent. which is implementation-dependent.
@retval EFI_SUCCESS The function executed successfully
**/ **/
EFI_STATUS VOID
EFIAPI EFIAPI
PrmLoaderEndOfDxeNotification ( PrmLoaderEndOfDxeNotification (
IN EFI_EVENT Event, IN EFI_EVENT Event,
@ -314,8 +312,6 @@ PrmLoaderEndOfDxeNotification (
FreePool (PrmAcpiDescriptionTable); FreePool (PrmAcpiDescriptionTable);
} }
gBS->CloseEvent (Event); gBS->CloseEvent (Event);
return EFI_SUCCESS;
} }
/** /**