]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c
1. remove duplicated NetLibDispatchDpc() calling in Pool function.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Option.c
index 559fd9ad0eca24addf62fac3165693d5f670ba37..8c4060517c1fab89f78e1e60052c001f0406b268 100644 (file)
@@ -604,7 +604,6 @@ DhcpParseOption (
   *OptionPoint  = NULL;\r
 \r
   if (OptNum == 0) {\r
-    Status = EFI_NOT_FOUND;\r
     goto ON_EXIT;\r
   }\r
 \r
@@ -626,14 +625,14 @@ DhcpParseOption (
   Status          = DhcpIterateOptions (Packet, DhcpFillOption, &Context);\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (Options);\r
+    FreePool (Options);\r
     goto ON_EXIT;\r
   }\r
 \r
   *OptionPoint = Options;\r
 \r
 ON_EXIT:\r
-  gBS->FreePool (OptCount);\r
+  FreePool (OptCount);\r
   return Status;\r
 }\r
 \r
@@ -675,7 +674,8 @@ DhcpValidateOptions (
   if (EFI_ERROR (Status) || (Count == 0)) {\r
     return Status;\r
   }\r
-  \r
+  ASSERT (AllOption != NULL);\r
+\r
   Updated = FALSE;\r
   ZeroMem (&Parameter, sizeof (Parameter));\r
 \r
@@ -710,16 +710,15 @@ DhcpValidateOptions (
   }\r
 \r
   if (Updated && (Para != NULL)) {\r
-    if ((*Para = AllocatePool (sizeof (DHCP_PARAMETER))) == NULL) {\r
+    *Para = AllocateCopyPool (sizeof (DHCP_PARAMETER), &Parameter);\r
+    if (*Para == NULL) {\r
       Status = EFI_OUT_OF_RESOURCES;\r
       goto ON_EXIT;\r
     }\r
-\r
-    CopyMem (*Para, &Parameter, sizeof (**Para));\r
   }\r
 \r
 ON_EXIT:\r
-  gBS->FreePool (AllOption);\r
+  FreePool (AllOption);\r
   return Status;\r
 }\r
 \r
@@ -825,10 +824,11 @@ DhcpBuild (
   if (EFI_ERROR (Status)) {\r
     goto ON_ERROR;\r
   }\r
-  ASSERT (SeedOptions != NULL);\r
 \r
-  for (Index = 0; Index < (UINT32) Count; Index++) {\r
-    Mark[SeedOptions[Index].Tag] = SeedOptions[Index];\r
+  if (SeedOptions != NULL) {\r
+    for (Index = 0; Index < (UINT32) Count; Index++) {\r
+      Mark[SeedOptions[Index].Tag] = SeedOptions[Index];\r
+    }\r
   }\r
 \r
   //\r
@@ -888,9 +888,9 @@ DhcpBuild (
 \r
 ON_ERROR:\r
   if (SeedOptions != NULL) {\r
-    gBS->FreePool (SeedOptions);\r
+    FreePool (SeedOptions);\r
   }\r
 \r
-  gBS->FreePool (Mark);\r
+  FreePool (Mark);\r
   return Status;\r
 }\r