Commit 2e1a2556 authored by Andrew Donnellan's avatar Andrew Donnellan Committed by Michael Ellerman

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: default avatarDaniel Axtens <dja@axtens.net>
Signed-off-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 6b8b252f
...@@ -290,8 +290,10 @@ void cxl_pci_vphb_remove(struct cxl_afu *afu) ...@@ -290,8 +290,10 @@ void cxl_pci_vphb_remove(struct cxl_afu *afu)
return; return;
phb = afu->phb; phb = afu->phb;
afu->phb = NULL;
pci_remove_root_bus(phb->bus); pci_remove_root_bus(phb->bus);
pcibios_free_controller(phb);
} }
struct cxl_afu *cxl_pci_to_afu(struct pci_dev *dev) struct cxl_afu *cxl_pci_to_afu(struct pci_dev *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment