@@ -563,92 +563,90 @@ EFIAPI
SataControllerStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeInit;
EFI_SATA_CONTROLLER_PRIVATE_DATA *SataPrivateData;
//
// Open the produced protocol
//
Status = gBS->OpenProtocol (
Controller,
&gEfiIdeControllerInitProtocolGuid,
(VOID **) &IdeInit,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
SataPrivateData = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (IdeInit);
ASSERT (SataPrivateData != NULL);
//
// Uninstall the IDE Controller Init Protocol from this instance
//
Status = gBS->UninstallMultipleProtocolInterfaces (
Controller,
&gEfiIdeControllerInitProtocolGuid,
&(SataPrivateData->IdeInit),
NULL
);
if (EFI_ERROR (Status)) {
return Status;
}
- if (SataPrivateData != NULL) {
- if (SataPrivateData->DisqualifiedModes != NULL) {
- FreePool (SataPrivateData->DisqualifiedModes);
- }
- if (SataPrivateData->IdentifyData != NULL) {
- FreePool (SataPrivateData->IdentifyData);
- }
- if (SataPrivateData->IdentifyValid != NULL) {
- FreePool (SataPrivateData->IdentifyValid);
- }
- FreePool (SataPrivateData);
+ if (SataPrivateData->DisqualifiedModes != NULL) {
+ FreePool (SataPrivateData->DisqualifiedModes);
}
+ if (SataPrivateData->IdentifyData != NULL) {
+ FreePool (SataPrivateData->IdentifyData);
+ }
+ if (SataPrivateData->IdentifyValid != NULL) {
+ FreePool (SataPrivateData->IdentifyValid);
+ }
+ FreePool (SataPrivateData);
//
// Restore original PCI attributes
//
SataPrivateData->PciIo->Attributes (
SataPrivateData->PciIo,
EfiPciIoAttributeOperationSet,
SataPrivateData->OriginalPciAttributes,
NULL
);
//
// Close protocols opened by Sata Controller driver
//
return gBS->CloseProtocol (
Controller,
&gEfiPciIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
/**
Calculate the flat array subscript of a (Channel, Device) pair.
@param[in] SataPrivateData The private data structure corresponding to the
SATA controller that attaches the device for
which the flat array subscript is being
calculated.
@param[in] Channel The channel (ie. port) number on the SATA
controller that the device is attached to.
@param[in] Device The device number on the channel.
@return The flat array subscript suitable for indexing DisqualifiedModes,
IdentifyData, and IdentifyValid.
**/
"ASSERT (SataPrivateData != NULL)" is just a few lines higher up. Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> --- OvmfPkg/SataControllerDxe/SataController.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel