PPDO_DEVICE_DATA DeviceData,
PIRP Irp )
{
- BOOLEAN Done;
ULONG NumberOfResources = 0;
PCM_RESOURCE_LIST ResourceList;
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
ULONG ResourceListSize;
ULONG i;
-
/* Get current resources */
Buffer.Length = 0;
AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
resource= Buffer.Pointer;
/* Count number of resources */
- Done = FALSE;
- while (!Done)
+ while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
{
switch (resource->Type)
{
NumberOfResources++;
break;
}
- case ACPI_RESOURCE_TYPE_END_TAG:
- {
- Done = TRUE;
- break;
- }
default:
{
+ DPRINT1("Unknown resource type: %d\n", resource->Type);
break;
}
}
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePool(PagedPool, ResourceListSize);
if (!ResourceList)
- return FALSE;
+ {
+ ExFreePool(Buffer.Pointer);
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
ResourceList->Count = 1;
ResourceList->List[0].InterfaceType = Internal; /* FIXME */
ResourceList->List[0].BusNumber = 0; /* We're the only ACPI bus device in the system */
ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
/* Fill resources list structure */
- Done = FALSE;
- while (!Done)
+ while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
{
switch (resource->Type)
{
ResourceDescriptor++;
break;
}
- case ACPI_RESOURCE_TYPE_END_TAG:
- {
- Done = TRUE;
- break;
- }
default:
{
- DPRINT1("Unhandled resource type\n");
break;
}
}
PPDO_DEVICE_DATA DeviceData,
PIRP Irp )
{
- BOOLEAN Done;
ULONG NumberOfResources = 0;
ACPI_STATUS AcpiStatus;
ACPI_BUFFER Buffer;
resource= Buffer.Pointer;
/* Count number of resources */
- Done = FALSE;
- while (!Done)
+ while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
{
switch (resource->Type)
{
NumberOfResources++;
break;
}
- case ACPI_RESOURCE_TYPE_END_TAG:
- {
- Done = TRUE;
- break;
- }
default:
{
break;
if (!RequirementsList)
{
ExFreePool(Buffer.Pointer);
- return STATUS_SUCCESS;
+ return STATUS_INSUFFICIENT_RESOURCES;
}
RequirementsList->ListSize = RequirementsListSize;
RequirementsList->InterfaceType = Internal;
RequirementDescriptor = RequirementsList->List[0].Descriptors;
/* Fill resources list structure */
- Done = FALSE;
- while (!Done)
+ while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
{
switch (resource->Type)
{
RequirementDescriptor++;
break;
}
- case ACPI_RESOURCE_TYPE_END_TAG:
- {
- Done = TRUE;
- break;
- }
default:
{
- DPRINT1("Unhandled resource type\n");
break;
}
}