const struct acpi_dmar_pci_path *path;
struct acpi_drhd_unit *drhd = type == DMAR_TYPE ?
container_of(scope, struct acpi_drhd_unit, scope) : NULL;
- int depth, cnt, didx = 0;
+ int depth, cnt, didx = 0, ret;
if ( (cnt = scope_device_count(start, end)) < 0 )
return cnt;
{
struct acpi_hpet_unit *acpi_hpet_unit;
+ ret = -ENOMEM;
acpi_hpet_unit = xmalloc(struct acpi_hpet_unit);
if ( !acpi_hpet_unit )
- return -ENOMEM;
+ goto out;
acpi_hpet_unit->id = acpi_scope->enumeration_id;
acpi_hpet_unit->bus = bus;
acpi_hpet_unit->dev = path->dev;
if ( drhd )
{
+ ret = -ENOMEM;
acpi_ioapic_unit = xmalloc(struct acpi_ioapic_unit);
if ( !acpi_ioapic_unit )
- return -ENOMEM;
+ goto out;
acpi_ioapic_unit->apic_id = acpi_scope->enumeration_id;
acpi_ioapic_unit->ioapic.bdf.bus = bus;
acpi_ioapic_unit->ioapic.bdf.dev = path->dev;
start += acpi_scope->length;
}
- return 0;
+ ret = 0;
+
+ out:
+ if ( ret )
+ xfree(scope->devices);
+
+ return ret;
}
static int __init acpi_dmar_check_length(
}
if ( ret )
- xfree(atsr);
+ xfree(atsru);
else
acpi_register_atsr_unit(atsru);
return ret;