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.w...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c       | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index d8c48ec8b2..065528c937 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -364,10 +364,11 @@ Mtftp4Start (
   MTFTP4_PROTOCOL           *Instance;
   EFI_MTFTP4_OVERRIDE_DATA  *Override;
   EFI_MTFTP4_CONFIG_DATA    *Config;
   EFI_TPL                   OldTpl;
   EFI_STATUS                Status;
+  EFI_STATUS                TokenStatus;
 
   //
   // Validate the parameters
   //
   if ((This == NULL) || (Token == NULL) || (Token->Filename == NULL) ||
@@ -391,28 +392,28 @@ Mtftp4Start (
     return EFI_INVALID_PARAMETER;
   }
 
   Instance = MTFTP4_PROTOCOL_FROM_THIS (This);
 
-  Status = EFI_SUCCESS;
+  Status      = EFI_SUCCESS;
+  TokenStatus = EFI_SUCCESS;
+  
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
 
   if (Instance->State != MTFTP4_STATE_CONFIGED) {
     Status = EFI_NOT_STARTED;
   }
 
   if (Instance->Operation != 0) {
     Status = EFI_ACCESS_DENIED;
   }
 
-  if (EFI_ERROR (Status)) {
-    gBS->RestoreTPL (OldTpl);
-    return Status;
-  }
-
   if ((Token->OverrideData != NULL) && !Mtftp4OverrideValid (Instance, 
Token->OverrideData)) {
     Status = EFI_INVALID_PARAMETER;
+  }
+
+  if (EFI_ERROR (Status)) {
     gBS->RestoreTPL (OldTpl);
     return Status;
   }
 
   //
@@ -429,11 +430,11 @@ Mtftp4Start (
                TRUE,
                &Instance->RequestOption
                );
 
     if (EFI_ERROR (Status)) {
-      Status = EFI_DEVICE_ERROR;
+      TokenStatus = EFI_DEVICE_ERROR;
       goto ON_ERROR;
     }
   }
 
   //
@@ -482,13 +483,12 @@ Mtftp4Start (
 
   //
   // Config the unicast UDP child to send initial request
   //
   Status = Mtftp4ConfigUnicastPort (Instance->UnicastPort, Instance);
-
   if (EFI_ERROR (Status)) {
-    Status = EFI_DEVICE_ERROR;
+    TokenStatus = EFI_DEVICE_ERROR;
     goto ON_ERROR;
   }
 
   //
   // Set initial status.
@@ -503,11 +503,11 @@ Mtftp4Start (
   } else {
     Status = Mtftp4RrqStart (Instance, Operation);
   }
 
   if (EFI_ERROR (Status)) {
-    Status = EFI_DEVICE_ERROR;
+    TokenStatus = EFI_DEVICE_ERROR;
     goto ON_ERROR;
   }
 
   if (Token->Event != NULL) {
     gBS->RestoreTPL (OldTpl);
@@ -524,11 +524,11 @@ Mtftp4Start (
 
   gBS->RestoreTPL (OldTpl);
   return Token->Status;
 
 ON_ERROR:
-  Mtftp4CleanOperation (Instance, Status);
+  Mtftp4CleanOperation (Instance, TokenStatus);
   gBS->RestoreTPL (OldTpl);
 
   return Status;
 }
 
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to