public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "wenyi,xie" <xiewenyi2@huawei.com>
To: <devel@edk2.groups.io>, <abner.chang@hpe.com>, <nickle.wang@hpe.com>
Cc: <songdongkuang@huawei.com>, <xiewenyi2@huawei.com>
Subject: [PATCH EDK2 v1 1/1] RedfishPkg/RedfishRestExDxe:Simplify status check
Date: Wed, 19 Jan 2022 14:12:41 +0800	[thread overview]
Message-ID: <20220119061241.686837-2-xiewenyi2@huawei.com> (raw)
In-Reply-To: <20220119061241.686837-1-xiewenyi2@huawei.com>

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 | 38 +++++++++-----------
 1 file changed, 17 insertions(+), 21 deletions(-)

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


  reply	other threads:[~2022-01-19  6:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  6:12 [PATCH EDK2 v1 0/1] RedfishPkg/RedfishRestExDxe:Simplify status check wenyi,xie
2022-01-19  6:12 ` wenyi,xie [this message]
2022-01-19  7:29 ` Abner Chang
2022-01-19  7:39   ` wenyi,xie
2022-01-20  2:30     ` Abner Chang
2022-01-20 12:01       ` wenyi,xie
2022-01-20 13:37         ` [edk2-devel] " Abner Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220119061241.686837-2-xiewenyi2@huawei.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox