Fixed potential issues to release resources when error occurs.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4341 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -211,7 +211,9 @@ CirrusLogic5430ControllerDriverStart (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
|
||||
BOOLEAN PciAttributesSaved;
|
||||
|
||||
PciAttributesSaved = FALSE;
|
||||
//
|
||||
// Allocate Private context data for UGA Draw inteface.
|
||||
//
|
||||
@@ -255,6 +257,7 @@ CirrusLogic5430ControllerDriverStart (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
PciAttributesSaved = TRUE;
|
||||
|
||||
Status = Private->PciIo->Attributes (
|
||||
Private->PciIo,
|
||||
@@ -319,16 +322,17 @@ Error:
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Private) {
|
||||
if (Private->PciIo) {
|
||||
//
|
||||
// Restore original PCI attributes
|
||||
//
|
||||
Private->PciIo->Attributes (
|
||||
Private->PciIo,
|
||||
EfiPciIoAttributeOperationSet,
|
||||
Private->OriginalPciAttributes,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (PciAttributesSaved == TRUE) {
|
||||
//
|
||||
// Restore original PCI attributes
|
||||
//
|
||||
Private->PciIo->Attributes (
|
||||
Private->PciIo,
|
||||
EfiPciIoAttributeOperationSet,
|
||||
Private->OriginalPciAttributes,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
//
|
||||
// Close the PCI I/O Protocol
|
||||
//
|
||||
|
Reference in New Issue
Block a user