diff --git a/src/northbridge/amd/pi/00730F01/northbridge.c b/src/northbridge/amd/pi/00730F01/northbridge.c index 377d91eeae..ba17c614e5 100644 --- a/src/northbridge/amd/pi/00730F01/northbridge.c +++ b/src/northbridge/amd/pi/00730F01/northbridge.c @@ -491,11 +491,6 @@ static void add_ivrs_device_entries(struct device *parent, struct device *dev, unsigned int header_type; unsigned int is_pcie; - if (!root_level) { - root_level = malloc(sizeof(int8_t)); - *root_level = -1; - } - if (dev->path.type == DEVICE_PATH_PCI) { if ((dev->bus->secondary == 0x0) && @@ -536,8 +531,6 @@ static void add_ivrs_device_entries(struct device *parent, struct device *dev, sibling->sibling) add_ivrs_device_entries(dev, sibling, depth + 1, depth, root_level, current, length); - - free(root_level); } unsigned long acpi_fill_ivrs_ioapic(acpi_ivrs_t *ivrs, unsigned long current) @@ -643,7 +636,8 @@ static unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current) current += 8; /* Describe PCI devices */ - add_ivrs_device_entries(NULL, all_devices, 0, -1, NULL, ¤t, + int8_t root_level = -1; + add_ivrs_device_entries(NULL, all_devices, 0, -1, &root_level, ¤t, &ivrs->ivhd.length); /* Describe IOAPICs */ diff --git a/src/southbridge/amd/sr5650/sr5650.c b/src/southbridge/amd/sr5650/sr5650.c index 90ca5641cc..8131e77e5f 100644 --- a/src/southbridge/amd/sr5650/sr5650.c +++ b/src/southbridge/amd/sr5650/sr5650.c @@ -725,13 +725,6 @@ static void add_ivrs_device_entries(struct device *parent, struct device *dev, struct device *sibling; struct bus *link; - if (!root_level) { - root_level = malloc(sizeof(int8_t)); - if (root_level == NULL) - die("Error: Could not allocate a byte!\n"); - *root_level = -1; - } - if ((dev->path.type == DEVICE_PATH_PCI) && (dev->bus->secondary == 0x0) && (dev->path.pci.devfn == 0x0)) *root_level = depth; @@ -798,9 +791,6 @@ static void add_ivrs_device_entries(struct device *parent, struct device *dev, sibling = sibling->sibling) add_ivrs_device_entries(dev, sibling, depth + 1, depth, root_level, current, length); - - if (depth == 0) - free(root_level); } unsigned long acpi_fill_mcfg(unsigned long current) @@ -879,7 +869,8 @@ static unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current) current += 8; /* Describe PCI devices */ - add_ivrs_device_entries(NULL, all_devices, 0, -1, NULL, ¤t, + int8_t root_level = -1; + add_ivrs_device_entries(NULL, all_devices, 0, -1, &root_level, ¤t, &ivrs->ivhd.length); /* Describe IOAPICs */