diff options
author | jji4 <jji4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-18 05:28:26 +0000 |
---|---|---|
committer | jji4 <jji4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-18 05:28:26 +0000 |
commit | 9b38ff3499b91b2350292306692607b930c00df3 (patch) | |
tree | 046f6ffa8382cbb724eb673117019a525684c8c4 /MdeModulePkg/Bus/Scsi | |
parent | d0cca731c3d468a6ac84e8e49c1d8f9c5e0d0aec (diff) | |
download | edk2-9b38ff3499b91b2350292306692607b930c00df3.zip edk2-9b38ff3499b91b2350292306692607b930c00df3.tar.gz edk2-9b38ff3499b91b2350292306692607b930c00df3.tar.bz2 |
Some codes have been altered and replaced by functions of memory allocation library.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7072 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Scsi')
-rw-r--r-- | MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c | 16 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 46 |
2 files changed, 23 insertions, 39 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c index 7ee8c50..654e5c0 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c @@ -429,11 +429,11 @@ SCSIBusDriverBindingStart ( }
FreePool (ScsiTargetId);
return EFI_SUCCESS;
-
+
ErrorExit:
if (ScsiBusDev != NULL) {
- gBS->FreePool (ScsiBusDev);
+ FreePool (ScsiBusDev);
}
if (ExtScsiSupport) {
@@ -854,13 +854,9 @@ ScsiExecuteSCSICommand ( );
} else {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET),
- (VOID**)&mWorkingBuffer
- );
+ mWorkingBuffer = AllocatePool (sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET));
- if (EFI_ERROR (Status)) {
+ if (mWorkingBuffer == NULL) {
return EFI_DEVICE_ERROR;
}
@@ -900,7 +896,7 @@ ScsiExecuteSCSICommand ( );
if (EFI_ERROR(Status)) {
- gBS->FreePool(mWorkingBuffer);
+ FreePool(mWorkingBuffer);
gBS->CloseEvent(PacketEvent);
return Status;
}
@@ -1047,7 +1043,7 @@ ScsiScanCreateDevice ( NULL
);
if (EFI_ERROR (Status)) {
- gBS->FreePool (ScsiIoDevice);
+ FreePool (ScsiIoDevice);
return EFI_OUT_OF_RESOURCES;
} else {
if (ScsiBusDev->ExtScsiSupport) {
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index 95d5c8c..3c81e99 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -25,6 +25,7 @@ EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding = { NULL
};
+
/**
The user Entry Point for module ScsiDisk.
@@ -160,17 +161,11 @@ ScsiDiskDriverBindingStart ( UINT8 MaxRetry;
BOOLEAN NeedRetry;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (SCSI_DISK_DEV),
- (VOID **) &ScsiDiskDevice
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ ScsiDiskDevice = (SCSI_DISK_DEV *) AllocateZeroPool (sizeof (SCSI_DISK_DEV));
+ if (ScsiDiskDevice == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- ZeroMem (ScsiDiskDevice, sizeof (SCSI_DISK_DEV));
-
Status = gBS->OpenProtocol (
Controller,
&gEfiScsiIoProtocolGuid,
@@ -180,7 +175,7 @@ ScsiDiskDriverBindingStart ( EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
- gBS->FreePool (ScsiDiskDevice);
+ FreePool (ScsiDiskDevice);
return Status;
}
@@ -207,27 +202,20 @@ ScsiDiskDriverBindingStart ( // The Sense Data Array's initial size is 6
//
ScsiDiskDevice->SenseDataNumber = 6;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_SCSI_SENSE_DATA) * ScsiDiskDevice->SenseDataNumber,
- (VOID **) &(ScsiDiskDevice->SenseData)
- );
- if (EFI_ERROR (Status)) {
+ ScsiDiskDevice->SenseData = (EFI_SCSI_SENSE_DATA *) AllocateZeroPool (
+ sizeof (EFI_SCSI_SENSE_DATA) * ScsiDiskDevice->SenseDataNumber
+ );
+ if (ScsiDiskDevice->SenseData == NULL) {
gBS->CloseProtocol (
Controller,
&gEfiScsiIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
- gBS->FreePool (ScsiDiskDevice);
- return Status;
+ FreePool (ScsiDiskDevice);
+ return EFI_OUT_OF_RESOURCES;
}
- ZeroMem (
- ScsiDiskDevice->SenseData,
- sizeof (EFI_SCSI_SENSE_DATA) * ScsiDiskDevice->SenseDataNumber
- );
-
//
// Retrieve device information
//
@@ -239,14 +227,14 @@ ScsiDiskDriverBindingStart ( }
if (!NeedRetry) {
- gBS->FreePool (ScsiDiskDevice->SenseData);
+ FreePool (ScsiDiskDevice->SenseData);
gBS->CloseProtocol (
Controller,
&gEfiScsiIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
- gBS->FreePool (ScsiDiskDevice);
+ FreePool (ScsiDiskDevice);
return EFI_DEVICE_ERROR;
}
}
@@ -265,14 +253,14 @@ ScsiDiskDriverBindingStart ( }
if (EFI_ERROR (Status)) {
- gBS->FreePool (ScsiDiskDevice->SenseData);
+ FreePool (ScsiDiskDevice->SenseData);
gBS->CloseProtocol (
Controller,
&gEfiScsiIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
- gBS->FreePool (ScsiDiskDevice);
+ FreePool (ScsiDiskDevice);
return Status;
}
@@ -2187,7 +2175,7 @@ ReleaseScsiDiskDeviceResources ( }
if (ScsiDiskDevice->SenseData != NULL) {
- gBS->FreePool (ScsiDiskDevice->SenseData);
+ FreePool (ScsiDiskDevice->SenseData);
ScsiDiskDevice->SenseData = NULL;
}
@@ -2196,7 +2184,7 @@ ReleaseScsiDiskDeviceResources ( ScsiDiskDevice->ControllerNameTable = NULL;
}
- gBS->FreePool (ScsiDiskDevice);
+ FreePool (ScsiDiskDevice);
ScsiDiskDevice = NULL;
}
|