]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PrmPkg: Enforce stricter types
authorMichael Kubacki <michael.kubacki@microsoft.com>
Tue, 16 Jun 2020 16:32:38 +0000 (09:32 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Apr 2022 00:42:38 +0000 (00:42 +0000)
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>
PrmPkg/Application/PrmInfo/PrmInfo.c
PrmPkg/PrmConfigDxe/PrmConfigDxe.c
PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c

index 431a6f206163339a2bb603a9772486e1a955de35..e479667ec7ebc3182baa2235d9d54c1807c14d59 100644 (file)
@@ -221,7 +221,7 @@ GatherPrmHandlerInfo (
     Status = GetModuleContextBuffers (\r
               ByModuleGuid,\r
               CurrentModuleGuid,\r
-              &CurrentModuleContextBuffers\r
+              (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContextBuffers\r
               );\r
     ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);\r
     if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {\r
@@ -272,7 +272,7 @@ GatherPrmHandlerInfo (
       Status =  GetContextBuffer (\r
                   CurrentHandlerContext.Guid,\r
                   CurrentModuleContextBuffers,\r
-                  &CurrentContextBuffer\r
+                  (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer\r
                   );\r
       if (!EFI_ERROR (Status)) {\r
         CurrentHandlerContext.StaticDataBuffer = CurrentContextBuffer->StaticDataBuffer;\r
@@ -520,7 +520,7 @@ ParseParameterList (
   )\r
 {\r
   EFI_STATUS                            Status;\r
-  SHELL_STATUS                          ReturnStatus;\r
+  EFI_STATUS                            ReturnStatus;\r
   UINTN                                 ArgumentCount;\r
   EFI_GUID                              HandlerGuid;\r
   BOOLEAN                               PrintHandlerInfo;\r
index c547db3eca5ec2d672d10d1acfeac88ccf6622b7..f3223d63de0c2e41187e28e1f5b79828d67fd8d7 100644 (file)
@@ -361,10 +361,8 @@ PrmConfigVirtualAddressChangeEvent (
   @param[in]  Context         The pointer to the notification function's context,\r
                               which is implementation-dependent.\r
 \r
-  @retval EFI_SUCCESS         The function executed successfully\r
-\r
 **/\r
-EFI_STATUS\r
+VOID\r
 EFIAPI\r
 PrmConfigEndOfDxeNotification (\r
   IN  EFI_EVENT               Event,\r
@@ -446,8 +444,6 @@ PrmConfigEndOfDxeNotification (
     gBS->FreePool (HandleBuffer);\r
   }\r
   gBS->CloseEvent(Event);\r
-\r
-  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -476,7 +472,7 @@ PrmConfigEntryPoint (
   // Register a notification function to change memory attributes at end of DXE\r
   //\r
   Event = NULL;\r
-  Status = gBS->CreateEventEx(\r
+  Status = gBS->CreateEventEx (\r
                   EVT_NOTIFY_SIGNAL,\r
                   TPL_CALLBACK,\r
                   PrmConfigEndOfDxeNotification,\r
index 407c4825743222a38febeec5be3eb1132eb8d5ba..aa7aab391e8c30cd70fabb2a09f8768326d52191 100644 (file)
@@ -151,7 +151,7 @@ ProcessPrmModules (
     Status = GetModuleContextBuffers (\r
               ByModuleGuid,\r
               &CurrentModuleInfoStruct->Identifier,\r
-              &CurrentModuleContextBuffers\r
+              (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContextBuffers\r
               );\r
     ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);\r
     if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {\r
@@ -177,7 +177,7 @@ ProcessPrmModules (
       Status =  GetContextBuffer (\r
                   &CurrentHandlerInfoStruct->Identifier,\r
                   CurrentModuleContextBuffers,\r
-                  &CurrentContextBuffer\r
+                  (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer\r
                   );\r
       if (!EFI_ERROR (Status)) {\r
         CurrentHandlerInfoStruct->StaticDataBuffer = (UINT64) (UINTN) CurrentContextBuffer->StaticDataBuffer;\r
@@ -286,10 +286,8 @@ PublishPrmAcpiTable (
   @param[in]  Context                     The pointer to the notification function's context,\r
                                           which is implementation-dependent.\r
 \r
-  @retval EFI_SUCCESS                     The function executed successfully\r
-\r
 **/\r
-EFI_STATUS\r
+VOID\r
 EFIAPI\r
 PrmLoaderEndOfDxeNotification (\r
   IN  EFI_EVENT                           Event,\r
@@ -314,8 +312,6 @@ PrmLoaderEndOfDxeNotification (
     FreePool (PrmAcpiDescriptionTable);\r
   }\r
   gBS->CloseEvent (Event);\r
-\r
-  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r