ARM64: PCI: Fix struct acpi_pci_root_ops allocation failure path
authorTimmy Li <lixiaoping3@huawei.com>
Mon, 22 May 2017 15:48:28 +0000 (16:48 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 25 May 2017 15:52:58 +0000 (16:52 +0100)
commit717902cc93118119a6fce7765da6cf2786987418
tree16546ce2cb33a4d6595008858d33dda5bb980607
parent63a1e1c95e60e798fa09ab3c536fb555aa5bbf2b
ARM64: PCI: Fix struct acpi_pci_root_ops allocation failure path

Commit 093d24a20442 ("arm64: PCI: Manage controller-specific data on
per-controller basis") added code to allocate ACPI PCI root_ops
dynamically on a per host bridge basis but failed to update the
corresponding memory allocation failure path in pci_acpi_scan_root()
leading to a potential memory leakage.

Fix it by adding the required kfree call.

Fixes: 093d24a20442 ("arm64: PCI: Manage controller-specific data on per-controller basis")
Reviewed-by: Tomasz Nowicki <tn@semihalf.com>
Signed-off-by: Timmy Li <lixiaoping3@huawei.com>
[lorenzo.pieralisi@arm.com: refactored code, rewrote commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/pci.c