From 82b81c64643bb08ba5bf928c5861d6e82b12f160 Mon Sep 17 00:00:00 2001 From: Pedro Falcato Date: Thu, 1 Jun 2023 18:27:31 +0100 Subject: MdeModulePkg/SataControllerDxe: Remove useless null check ASSERT (Private != NULL) already covers this check. See commit 81310a6. Signed-off-by: Pedro Falcato Reviewed-by: Laszlo Ersek Reviewed-by: Hao A Wu --- .../Bus/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 277bc6182d..f0ffd311d7 100644 --- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c +++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c @@ -626,34 +626,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 // -- cgit v1.2.3