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

Cc: Jian J Wang <jian.j.w...@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Hao A Wu <hao.a...@intel.com>
Cc: Ray Ni <ray...@intel.com>
Signed-off-by: Pedro Falcato <pedro.falc...@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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104295): https://edk2.groups.io/g/devel/message/104295
Mute This Topic: https://groups.io/mt/98771780/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to