public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: devel@edk2.groups.io
Cc: Pedro Falcato <pedro.falcato@gmail.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: [PATCH 1/2] MdeModulePkg/SataControllerDxe: Remove useless null check
Date: Mon,  8 May 2023 22:52:45 +0100	[thread overview]
Message-ID: <20230508215246.217002-2-pedro.falcato@gmail.com> (raw)
In-Reply-To: <20230508215246.217002-1-pedro.falcato@gmail.com>

ASSERT (Private != NULL) already covers this check.
See commit 81310a6.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
---
 .../Pci/SataControllerDxe/SataController.c    | 44 +++++++++----------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
index f661efaec7e9..ab069845fd02 100644
--- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
+++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
@@ -625,34 +625,32 @@ SataControllerStop (
     return Status;
   }
 
-  if (Private != NULL) {
-    if (Private->DisqualifiedModes != NULL) {
-      FreePool (Private->DisqualifiedModes);
-    }
-
-    if (Private->IdentifyData != NULL) {
-      FreePool (Private->IdentifyData);
-    }
+  if (Private->DisqualifiedModes != NULL) {
+    FreePool (Private->DisqualifiedModes);
+  }
 
-    if (Private->IdentifyValid != NULL) {
-      FreePool (Private->IdentifyValid);
-    }
+  if (Private->IdentifyData != NULL) {
+    FreePool (Private->IdentifyData);
+  }
 
-    if (Private->PciAttributesChanged) {
-      //
-      // Restore original PCI attributes
-      //
-      Private->PciIo->Attributes (
-                        Private->PciIo,
-                        EfiPciIoAttributeOperationSet,
-                        Private->OriginalPciAttributes,
-                        NULL
-                        );
-    }
+  if (Private->IdentifyValid != NULL) {
+    FreePool (Private->IdentifyValid);
+  }
 
-    FreePool (Private);
+  if (Private->PciAttributesChanged) {
+    //
+    // Restore original PCI attributes
+    //
+    Private->PciIo->Attributes (
+                      Private->PciIo,
+                      EfiPciIoAttributeOperationSet,
+                      Private->OriginalPciAttributes,
+                      NULL
+                      );
   }
 
+  FreePool (Private);
+
   //
   // Close protocols opened by Sata Controller driver
   //
-- 
2.40.1


  reply	other threads:[~2023-05-08 21:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 21:52 [PATCH 0/2] OvmfPkg: Replace the OVMF-specific SataControllerDxe with the generic one Pedro Falcato
2023-05-08 21:52 ` Pedro Falcato [this message]
2023-05-08 22:28   ` [edk2-devel] [PATCH 1/2] MdeModulePkg/SataControllerDxe: Remove useless null check Mike Maslenkin
2023-05-08 22:46     ` Pedro Falcato
2023-05-08 21:52 ` [PATCH 2/2] OvmfPkg: Replace the OVMF-specific SataControllerDxe with a generic one Pedro Falcato
2023-05-09  8:10   ` Laszlo Ersek
2023-05-09  7:36 ` [PATCH 0/2] OvmfPkg: Replace the OVMF-specific SataControllerDxe with the " Gerd Hoffmann
2023-05-09  8:06 ` Laszlo Ersek
2023-05-09 16:46   ` Pedro Falcato

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=20230508215246.217002-2-pedro.falcato@gmail.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