]> git.proxmox.com Git - mirror_edk2.git/commitdiff
RedfishPkg/RedfishRestExDxe:Simplify status check
authorWenyi Xie <xiewenyi2@huawei.com>
Wed, 19 Jan 2022 03:47:00 +0000 (11:47 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 20 Jan 2022 13:26:51 +0000 (13:26 +0000)
Remove redundant determine statements.
No functional change.

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c

index eb1d8b8fa23603500d5e90ccf31f013af8dd9ef0..952e9d103a565eb035c17ecff88bdbed7a593a85 100644 (file)
@@ -44,7 +44,7 @@ ResetHttpTslSession (
 }\r
 \r
 /**\r
-  This function check\r
+  This function check Http receive status.\r
 \r
   @param[in]  Instance             Pointer to EFI_REST_EX_PROTOCOL instance for a particular\r
                                    REST service.\r
@@ -67,37 +67,34 @@ RedfishCheckHttpReceiveStatus (
 \r
   if (!EFI_ERROR (HttpIoReceiveStatus)) {\r
     ReturnStatus = EFI_SUCCESS;\r
-  } else if (EFI_ERROR (HttpIoReceiveStatus) && (HttpIoReceiveStatus != EFI_CONNECTION_FIN)) {\r
+  } else if (HttpIoReceiveStatus != EFI_CONNECTION_FIN) {\r
     if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY) == 0) {\r
       DEBUG ((DEBUG_ERROR, "%a: TCP error, reset HTTP session.\n", __FUNCTION__));\r
       Instance->Flags |= RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY;\r
       gBS->Stall (500);\r
       Status = ResetHttpTslSession (Instance);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));\r
-        ReturnStatus = EFI_DEVICE_ERROR;\r
-      } else {\r
+      if (!EFI_ERROR (Status)) {\r
         return EFI_NOT_READY;\r
       }\r
-    } else {\r
-      ReturnStatus = EFI_DEVICE_ERROR;\r
+\r
+      DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));\r
     }\r
-  } else {\r
-    if (HttpIoReceiveStatus == EFI_CONNECTION_FIN) {\r
-      if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) {\r
-        DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a new TLS session.\n", __FUNCTION__));\r
-        ReturnStatus = EFI_DEVICE_ERROR;\r
-      }\r
 \r
-      Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY;\r
-      Status           = ResetHttpTslSession (Instance);\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));\r
-        ReturnStatus = EFI_DEVICE_ERROR;\r
-      }\r
+    ReturnStatus = EFI_DEVICE_ERROR;\r
+  } else {\r
+    if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) {\r
+      DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a new TLS session.\n", __FUNCTION__));\r
+      ReturnStatus = EFI_DEVICE_ERROR;\r
+    }\r
 \r
-      return EFI_NOT_READY;\r
+    Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY;\r
+    Status           = ResetHttpTslSession (Instance);\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));\r
+      ReturnStatus = EFI_DEVICE_ERROR;\r
     }\r
+\r
+    return EFI_NOT_READY;\r
   }\r
 \r
   //\r