Fix a bug in the Fat Stop() function which may return EFI_NOT_FOUND when the controller handle doesn't support DiskIo2.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

(based on FatPkg commit 3454cf4f33cb3b71ebc19705a4d49f1ff3715611)

[jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Mark Doran <mark.doran@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Ruiyu Ni 2013-11-22 07:39:02 +00:00 committed by Jordan Justen
parent 833b5a77a3
commit 9e710bc95e
1 changed files with 23 additions and 17 deletions

View File

@ -399,7 +399,9 @@ Returns:
EFI_STATUS Status;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
FAT_VOLUME *Volume;
EFI_DISK_IO2_PROTOCOL *DiskIo2;
DiskIo2 = NULL;
//
// Get our context back
//
@ -413,25 +415,29 @@ Returns:
);
if (!EFI_ERROR (Status)) {
Volume = VOLUME_FROM_VOL_INTERFACE (FileSystem);
Status = FatAbandonVolume (Volume);
if (EFI_ERROR (Status)) {
return Status;
}
Volume = VOLUME_FROM_VOL_INTERFACE (FileSystem);
DiskIo2 = Volume->DiskIo2;
Status = FatAbandonVolume (Volume);
}
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiDiskIo2ProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
if (!EFI_ERROR (Status)) {
if (DiskIo2 != NULL) {
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiDiskIo2ProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ASSERT_EFI_ERROR (Status);
}
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ASSERT_EFI_ERROR (Status);
}
return Status;
}