* [PATCH] cxl: Free virtual PHB when removing
@ 2015-10-13 4:09 Andrew Donnellan
2015-10-15 11:10 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Donnellan @ 2015-10-13 4:09 UTC (permalink / raw)
To: linuxppc-dev; +Cc: imunsie, mikey, Daniel Axtens
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>
---
This patch depends on "powerpc/pci: export pcibios_free_controller()" [0].
[0] https://patchwork.ozlabs.org/patch/516142/
---
drivers/misc/cxl/vphb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 94b5208..c241e15 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)
--
Andrew Donnellan Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com Australia Development Lab, Canberra
+61 2 6201 8874 (work) IBM Australia Limited
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: cxl: Free virtual PHB when removing
2015-10-13 4:09 [PATCH] cxl: Free virtual PHB when removing Andrew Donnellan
@ 2015-10-15 11:10 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2015-10-15 11:10 UTC (permalink / raw)
To: Andrew Donnellan, linuxppc-dev; +Cc: mikey, imunsie, Daniel Axtens
On Tue, 2015-13-10 at 04:09:44 UTC, Andrew Donnellan wrote:
> 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>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/2e1a2556ebbbe7b53a05b721
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-15 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 4:09 [PATCH] cxl: Free virtual PHB when removing Andrew Donnellan
2015-10-15 11:10 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).