fix null DevicePath issue.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11360 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
erictian 2011-03-10 05:01:15 +00:00
parent 487ef01803
commit e70ae46c00
1 changed files with 3 additions and 0 deletions

View File

@ -193,13 +193,16 @@ RegisterAtaDevice (
DevicePath = AppendDevicePathNode (AtaBusDriverData->ParentDevicePath, NewDevicePathNode);
if (DevicePath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
DeviceHandle = NULL;
RemainingDevicePath = DevicePath;
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);
if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {
Status = EFI_ALREADY_STARTED;
FreePool (DevicePath);
goto Done;
}