Skip to content

Commit

Permalink
cxl: Free virtual PHB when removing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrew Donnellan authored and Michael Ellerman committed Oct 15, 2015
1 parent 6b8b252 commit 2e1a255
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/misc/cxl/vphb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e1a255

Please sign in to comment.