]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c
Clean up the following module msa files.
[mirror_edk2.git] / EdkModulePkg / Universal / UserInterface / DriverSample / DriverSample.c
index f78d4226e5bcdb342c50f2c2c7d71b16266399a1..0de1fca414d3775387812ceb0ceaa95a7cb8360a 100644 (file)
@@ -1,5 +1,5 @@
 /*++\r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -61,7 +61,6 @@ Returns:
 {\r
   EFI_CALLBACK_INFO       *Private;\r
   EFI_HII_UPDATE_DATA     *UpdateData;\r
-  EFI_STATUS              Status;\r
   UINT8                   *Location;\r
   EFI_HII_CALLBACK_PACKET *DataPacket;\r
   UINT16                  Value;\r
@@ -159,8 +158,8 @@ Returns:
                     UpdateData\r
                     );\r
 \r
-    gBS->FreePool (UpdateData);\r
-    gBS->FreePool (OptionList);\r
+    FreePool (UpdateData);\r
+    FreePool (OptionList);\r
     break;\r
 \r
   case 0x0002:\r
@@ -235,8 +234,8 @@ Returns:
                     UpdateData\r
                     );\r
 \r
-    gBS->FreePool (UpdateData);\r
-    gBS->FreePool (OptionList);\r
+    FreePool (UpdateData);\r
+    FreePool (OptionList);\r
     break;\r
 \r
   case 0x1234:\r
@@ -244,14 +243,8 @@ Returns:
     // Allocate space for creation of Buffer\r
     //\r
     QuestionId = (UINT16) ((UINTN) (&NVStruc.DynamicCheck) - (UINTN) (&NVStruc));\r
-    Status = gBS->AllocatePool (\r
-                    EfiBootServicesData,\r
-                    0x1000,\r
-                    (VOID **) &UpdateData\r
-                    );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    ZeroMem (UpdateData, 0x1000);\r
+    UpdateData = AllocateZeroPool (0x1000);\r
+    ASSERT (UpdateData != NULL);\r
 \r
     Location                        = (UINT8 *) &UpdateData->Data;\r
 \r
@@ -290,7 +283,7 @@ Returns:
                     UpdateData\r
                     );\r
 \r
-    gBS->FreePool (UpdateData);\r
+    FreePool (UpdateData);\r
     QuestionId++;\r
     break;\r
 \r
@@ -298,14 +291,8 @@ Returns:
     //\r
     // Allocate space for creation of Buffer\r
     //\r
-    Status = gBS->AllocatePool (\r
-                    EfiBootServicesData,\r
-                    0x1000,\r
-                    (VOID **)&UpdateData\r
-                    );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    ZeroMem (UpdateData, 0x1000);\r
+    UpdateData = AllocateZeroPool (0x1000);\r
+    ASSERT (UpdateData != NULL);\r
 \r
     //\r
     // Initialize DataPacket with information intended to remove all\r
@@ -355,7 +342,7 @@ Returns:
                     UpdateData\r
                     );\r
 \r
-    gBS->FreePool (UpdateData);\r
+    FreePool (UpdateData);\r
     break;\r
 \r
   case 0x1236:\r
@@ -368,14 +355,8 @@ Returns:
     // an error and fill in the string parameter, otherwise, I will return information in the DataArray structure.\r
     // The browser will free this packet structure\r
     //\r
-    Status = gBS->AllocatePool (\r
-                    EfiBootServicesData,\r
-                    sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2,\r
-                    (VOID **) Packet\r
-                    );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    ZeroMem (*Packet, sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2);\r
+    *Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2);\r
+    ASSERT (*Packet != NULL);\r
 \r
     //\r
     // Assign the buffer address to DataPacket\r
@@ -387,14 +368,8 @@ Returns:
 \r
   case 0x1237:\r
 \r
-    Status = gBS->AllocatePool (\r
-                    EfiBootServicesData,\r
-                    sizeof (EFI_HII_CALLBACK_PACKET) + 2,\r
-                    (VOID **) Packet\r
-                    );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    ZeroMem (*Packet, sizeof (EFI_HII_CALLBACK_PACKET) + 2);\r
+    *Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);\r
+    ASSERT (*Packet != NULL);\r
 \r
     //\r
     // Assign the buffer address to DataPacket\r
@@ -410,39 +385,39 @@ Returns:
     Value = 0x0001;\r
     UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);\r
 \r
-    Status = gRT->SetVariable (\r
-                    VariableName,\r
-                    &mFormSetGuid,\r
-                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                    2,\r
-                    (VOID *) &Value\r
-                    );\r
+    gRT->SetVariable (\r
+          VariableName,\r
+          &mFormSetGuid,\r
+          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+          2,\r
+          (VOID *) &Value\r
+          );\r
     break;\r
 \r
   case 0x1556:\r
     Value = 0x1000;\r
     UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);\r
 \r
-    Status = gRT->SetVariable (\r
-                    VariableName,\r
-                    &mFormSetGuid,\r
-                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                    2,\r
-                    (VOID *) &Value\r
-                    );\r
+    gRT->SetVariable (\r
+          VariableName,\r
+          &mFormSetGuid,\r
+          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+          2,\r
+          (VOID *) &Value\r
+          );\r
     break;\r
 \r
   case 0x1557:\r
     Value = 0x0000;\r
     UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);\r
 \r
-    Status = gRT->SetVariable (\r
-                    VariableName,\r
-                    &mFormSetGuid,\r
-                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                    2,\r
-                    (VOID *) &Value\r
-                    );\r
+    gRT->SetVariable (\r
+          VariableName,\r
+          &mFormSetGuid,\r
+          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+          2,\r
+          (VOID *) &Value\r
+          );\r
     break;\r
 \r
   default:\r
@@ -497,26 +472,9 @@ DriverSampleInit (
     return Status;;\r
   }\r
 \r
-  /*\r
-  //\r
-  // There should only be one Form Configuration protocol\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                 &gEfiFormBrowserProtocolGuid, \r
-                 NULL, \r
-                 &FormConfig\r
-                 );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;;\r
-  }\r
-*/\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  sizeof (EFI_CALLBACK_INFO),\r
-                  (VOID **) &CallbackInfo\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
+  CallbackInfo = AllocatePool (sizeof (EFI_CALLBACK_INFO));\r
+  if (CallbackInfo == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
   CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;\r
@@ -546,15 +504,15 @@ DriverSampleInit (
 \r
   PackageList                   = PreparePackages (1, &mStringPackGuid, DriverSampleStrings);\r
   Status                        = Hii->NewPack (Hii, PackageList, &HiiHandle);\r
-  gBS->FreePool (PackageList);\r
+  FreePool (PackageList);\r
 \r
   PackageList = PreparePackages (1, &mStringPackGuid, InventoryBin);\r
   Status      = Hii->NewPack (Hii, PackageList, &HiiHandle);\r
-  gBS->FreePool (PackageList);\r
+  FreePool (PackageList);\r
 \r
   PackageList = PreparePackages (1, &mStringPackGuid, VfrBin);\r
   Status      = Hii->NewPack (Hii, PackageList, &HiiHandle);\r
-  gBS->FreePool (PackageList);\r
+  FreePool (PackageList);\r
 \r
   CallbackInfo->RegisteredHandle = HiiHandle;\r
 \r
@@ -589,14 +547,8 @@ DriverSampleInit (
   //\r
   // Allocate space for creation of Buffer\r
   //\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  0x1000,\r
-                  (VOID **) &UpdateData\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  ZeroMem (UpdateData, 0x1000);\r
+  UpdateData = AllocateZeroPool (0x1000);\r
+  ASSERT (UpdateData != NULL);\r
 \r
   //\r
   // Flag update pending in FormSet\r
@@ -614,7 +566,7 @@ DriverSampleInit (
 \r
   Hii->UpdateForm (Hii, HiiHandle, (EFI_FORM_LABEL) 100, TRUE, UpdateData);\r
 \r
-  gBS->FreePool (UpdateData);\r
+  FreePool (UpdateData);\r
 \r
   //\r
   // Example of how to display only the item we sent to HII\r