Skip to content

Commit 35e261c

Browse files
committed
Merge tag 'acpi-6.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fix from Rafael Wysocki: "Revert a commit that attempted to fix a memory leak in an error code path and introduced a different issue (Zhe Qiao)" * tag 'acpi-6.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: Revert "PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root()"
2 parents e540341 + 2b8be57 commit 35e261c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

drivers/pci/pci-acpi.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,19 +1676,24 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
16761676
return NULL;
16771677

16781678
root_ops = kzalloc(sizeof(*root_ops), GFP_KERNEL);
1679-
if (!root_ops)
1680-
goto free_ri;
1679+
if (!root_ops) {
1680+
kfree(ri);
1681+
return NULL;
1682+
}
16811683

16821684
ri->cfg = pci_acpi_setup_ecam_mapping(root);
1683-
if (!ri->cfg)
1684-
goto free_root_ops;
1685+
if (!ri->cfg) {
1686+
kfree(ri);
1687+
kfree(root_ops);
1688+
return NULL;
1689+
}
16851690

16861691
root_ops->release_info = pci_acpi_generic_release_info;
16871692
root_ops->prepare_resources = pci_acpi_root_prepare_resources;
16881693
root_ops->pci_ops = (struct pci_ops *)&ri->cfg->ops->pci_ops;
16891694
bus = acpi_pci_root_create(root, root_ops, &ri->common, ri->cfg);
16901695
if (!bus)
1691-
goto free_cfg;
1696+
return NULL;
16921697

16931698
/* If we must preserve the resource configuration, claim now */
16941699
host = pci_find_host_bridge(bus);
@@ -1705,14 +1710,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
17051710
pcie_bus_configure_settings(child);
17061711

17071712
return bus;
1708-
1709-
free_cfg:
1710-
pci_ecam_free(ri->cfg);
1711-
free_root_ops:
1712-
kfree(root_ops);
1713-
free_ri:
1714-
kfree(ri);
1715-
return NULL;
17161713
}
17171714

17181715
void pcibios_add_bus(struct pci_bus *bus)

0 commit comments

Comments
 (0)