summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl
diff options
context:
space:
mode:
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>2015-10-13 06:09:44 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2015-10-15 11:31:58 +0200
commit2e1a2556ebbbe7b53a05b721ac0d3d8ca9873cdb (patch)
treeb1911beab1e2b0cfa0d5a3bc874acb981d2d6226 /drivers/misc/cxl
parentpowerpc/pci: export pcibios_free_controller() (diff)
downloadlinux-2e1a2556ebbbe7b53a05b721ac0d3d8ca9873cdb.tar.xz
linux-2e1a2556ebbbe7b53a05b721ac0d3d8ca9873cdb.zip
cxl: Free virtual PHB when removing
When adding a vPHB in cxl_pci_vphb_add(), we allocate a pci_controller struct using pcibios_alloc_controller(). However, we don't free it in cxl_pci_vphb_remove(), causing a leak. Call pcibios_free_controller() in cxl_pci_vphb_remove() to free the vPHB data structure correctly. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc/cxl')
-rw-r--r--drivers/misc/cxl/vphb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 94b520896b18..c241e15cacb1 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -290,8 +290,10 @@ void cxl_pci_vphb_remove(struct cxl_afu *afu)
return;
phb = afu->phb;
+ afu->phb = NULL;
pci_remove_root_bus(phb->bus);
+ pcibios_free_controller(phb);
}
struct cxl_afu *cxl_pci_to_afu(struct pci_dev *dev)