]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Mtftp4Dxe: Fix the incorrect return status.
authorJiaxin Wu <jiaxin.wu@intel.com>
Mon, 12 Mar 2018 00:50:41 +0000 (08:50 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Tue, 13 Mar 2018 08:55:18 +0000 (16:55 +0800)
The incorrect return status was caused by the commit of 39b0867d, which
was to resolve the token status error that does not compliance with spec
definition, but it results the protocol status not compliance with spec
definition.

This patch is to resolve above issue.

Cc: Wang Fan <fan.wang@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wang, Fan <fan.wang@intel.com>
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c

index d8c48ec8b2b563ef00b7927d8b15d432628f68cf..065528c9371bbae27fd23c4503fe30c05959681c 100644 (file)
@@ -366,6 +366,7 @@ Mtftp4Start (
   EFI_MTFTP4_CONFIG_DATA    *Config;\r
   EFI_TPL                   OldTpl;\r
   EFI_STATUS                Status;\r
+  EFI_STATUS                TokenStatus;\r
 \r
   //\r
   // Validate the parameters\r
@@ -393,7 +394,9 @@ Mtftp4Start (
 \r
   Instance = MTFTP4_PROTOCOL_FROM_THIS (This);\r
 \r
-  Status = EFI_SUCCESS;\r
+  Status      = EFI_SUCCESS;\r
+  TokenStatus = EFI_SUCCESS;\r
+  \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   if (Instance->State != MTFTP4_STATE_CONFIGED) {\r
@@ -404,13 +407,11 @@ Mtftp4Start (
     Status = EFI_ACCESS_DENIED;\r
   }\r
 \r
-  if (EFI_ERROR (Status)) {\r
-    gBS->RestoreTPL (OldTpl);\r
-    return Status;\r
-  }\r
-\r
   if ((Token->OverrideData != NULL) && !Mtftp4OverrideValid (Instance, Token->OverrideData)) {\r
     Status = EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (EFI_ERROR (Status)) {\r
     gBS->RestoreTPL (OldTpl);\r
     return Status;\r
   }\r
@@ -431,7 +432,7 @@ Mtftp4Start (
                );\r
 \r
     if (EFI_ERROR (Status)) {\r
-      Status = EFI_DEVICE_ERROR;\r
+      TokenStatus = EFI_DEVICE_ERROR;\r
       goto ON_ERROR;\r
     }\r
   }\r
@@ -484,9 +485,8 @@ Mtftp4Start (
   // Config the unicast UDP child to send initial request\r
   //\r
   Status = Mtftp4ConfigUnicastPort (Instance->UnicastPort, Instance);\r
-\r
   if (EFI_ERROR (Status)) {\r
-    Status = EFI_DEVICE_ERROR;\r
+    TokenStatus = EFI_DEVICE_ERROR;\r
     goto ON_ERROR;\r
   }\r
 \r
@@ -505,7 +505,7 @@ Mtftp4Start (
   }\r
 \r
   if (EFI_ERROR (Status)) {\r
-    Status = EFI_DEVICE_ERROR;\r
+    TokenStatus = EFI_DEVICE_ERROR;\r
     goto ON_ERROR;\r
   }\r
 \r
@@ -526,7 +526,7 @@ Mtftp4Start (
   return Token->Status;\r
 \r
 ON_ERROR:\r
-  Mtftp4CleanOperation (Instance, Status);\r
+  Mtftp4CleanOperation (Instance, TokenStatus);\r
   gBS->RestoreTPL (OldTpl);\r
 \r
   return Status;\r