Fix code potential errors.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Tian, Feng <feng.tian@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13852 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2012-10-16 09:27:49 +00:00
parent fe8a16e52b
commit 3d267c70b2
3 changed files with 11 additions and 2 deletions

View File

@ -464,6 +464,7 @@ UnregisterAtaDevice (
if (BlockIo != NULL) {
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (BlockIo);
} else {
ASSERT (BlockIo2 != NULL);
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (BlockIo2);
}

View File

@ -133,6 +133,10 @@ AtaDevicePassThru (
if (TaskPacket != NULL) {
Packet = TaskPacket;
Packet->Asb = AllocateAlignedBuffer (AtaDevice, sizeof (EFI_ATA_STATUS_BLOCK));
if (Packet->Asb == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem (Packet->Asb, AtaDevice->Asb, sizeof (EFI_ATA_STATUS_BLOCK));
Packet->Acb = AllocateCopyPool (sizeof (EFI_ATA_COMMAND_BLOCK), &AtaDevice->Acb);
} else {
@ -939,6 +943,10 @@ TrustTransferAtaDevice (
AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
if ((AtaPassThru->Mode->IoAlign > 1) && !IS_ALIGNED (Buffer, AtaPassThru->Mode->IoAlign)) {
NewBuffer = AllocateAlignedBuffer (AtaDevice, TransferLength);
if (NewBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem (NewBuffer, Buffer, TransferLength);
FreePool (Buffer);
Buffer = NewBuffer;

View File

@ -148,7 +148,7 @@ CoreDumpGcdMemorySpaceMap (
UINTN Index;
Status = CoreGetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);
ASSERT_EFI_ERROR (Status);
ASSERT (Status == EFI_SUCCESS && MemorySpaceMap != NULL);
if (InitialMap) {
DEBUG ((DEBUG_GCD, "GCD:Initial GCD Memory Space Map\n"));
@ -190,7 +190,7 @@ CoreDumpGcdIoSpaceMap (
UINTN Index;
Status = CoreGetIoSpaceMap (&NumberOfDescriptors, &IoSpaceMap);
ASSERT_EFI_ERROR (Status);
ASSERT (Status == EFI_SUCCESS && IoSpaceMap != NULL);
if (InitialMap) {
DEBUG ((DEBUG_GCD, "GCD:Initial GCD I/O Space Map\n"));