From: Andrew Donnellan Date: Tue, 13 Oct 2015 04:09:44 +0000 (+1100) Subject: cxl: Free virtual PHB when removing X-Git-Tag: KARO-TX6UL-2015-11-03~123^2~25 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2e1a2556ebbbe7b53a05b721ac0d3d8ca9873cdb;p=karo-tx-linux.git 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 Signed-off-by: Andrew Donnellan Signed-off-by: Michael Ellerman --- 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)