lkml.org 
[lkml]   [2019]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi()
From
Date
Hi,

On 01/03/2019 05:04, Jisheng Zhang wrote:
> To avoid memory leak, we need to free the page for MSI in
> dw_pcie_free_msi().
>
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++
> drivers/pci/controller/dwc/pcie-designware.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index a94d3530b694..abe3ff5f0867 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -305,6 +305,8 @@ void dw_pcie_free_msi(struct pcie_port *pp)
>
> irq_domain_remove(pp->msi_domain);
> irq_domain_remove(pp->irq_domain);
> +
> + __free_page(pp->msi_page);

Perhaps you could test is msi_page is null or not before the free.

> }
>
> void dw_pcie_msi_init(struct pcie_port *pp)
> @@ -322,6 +324,7 @@ void dw_pcie_msi_init(struct pcie_port *pp)
> return;
> }
> msi_target = (u64)pp->msi_data;
> + pp->msi_page = page;

And maybe use the pp->msi_page variable from the beginning of the function, that
way is one less variable.

Regards,
Gustavo

>
> /* Program the msi_data */
> dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_LO, 4,
> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> index f6fb65a40f10..3be7ca9f1fc3 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.h
> +++ b/drivers/pci/controller/dwc/pcie-designware.h
> @@ -179,6 +179,7 @@ struct pcie_port {
> struct irq_domain *irq_domain;
> struct irq_domain *msi_domain;
> dma_addr_t msi_data;
> + struct page *msi_page;
> u32 num_vectors;
> u32 irq_mask[MAX_MSI_CTRLS];
> raw_spinlock_t lock;
>

\
 
 \ /
  Last update: 2019-03-13 11:12    [W:0.100 / U:7.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site