All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ray Jui <rjui@broadcom.com>
To: Hauke Mehrtens <hauke@hauke-m.de>, <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<bcm-kernel-feedback-list@broadcom.com>, <zajec5@gmail.com>
Subject: Re: [PATCH 2/2] PCI: iproc: free resource list after registration
Date: Mon, 25 May 2015 17:35:31 -0700	[thread overview]
Message-ID: <5563BFD3.5050902@broadcom.com> (raw)
In-Reply-To: <1432499823-27369-2-git-send-email-hauke@hauke-m.de>

Hi Hauke,

On 15-05-24 01:37 PM, Hauke Mehrtens wrote:
> The resource list is only used in the setup process and was never
> freed. pci_add_resource() allocates a memory area to store the list
> item. This patch fixes the memory leak.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>   drivers/pci/host/pcie-iproc-bcma.c     | 8 ++++----
>   drivers/pci/host/pcie-iproc-platform.c | 8 ++++----
>   2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-iproc-bcma.c b/drivers/pci/host/pcie-iproc-bcma.c
> index f96b39e..2e4f2d6 100644
> --- a/drivers/pci/host/pcie-iproc-bcma.c
> +++ b/drivers/pci/host/pcie-iproc-bcma.c
> @@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev)
>   	pcie->map_irq = iproc_pcie_bcma_map_irq;
>
>   	ret = iproc_pcie_setup(pcie, &res);
> -	if (ret) {
> +	if (ret)
>   		dev_err(pcie->dev, "PCIe controller setup failed\n");
> -		return ret;
> -	}
>
> -	return 0;
> +	pci_free_resource_list(&res);
> +
> +	return ret;
>   }
>
>   static void iproc_pcie_bcma_remove(struct bcma_device *bdev)
> diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c
> index c5fe4c1..9aedc8e 100644
> --- a/drivers/pci/host/pcie-iproc-platform.c
> +++ b/drivers/pci/host/pcie-iproc-platform.c
> @@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
>   	pcie->map_irq = of_irq_parse_and_map_pci;
>
>   	ret = iproc_pcie_setup(pcie, &res);
> -	if (ret) {
> +	if (ret)
>   		dev_err(pcie->dev, "PCIe controller setup failed\n");
> -		return ret;
> -	}
>
> -	return 0;
> +	pci_free_resource_list(&res);
> +
> +	return ret;
>   }
>
>   static int iproc_pcie_pltfm_remove(struct platform_device *pdev)
>

This looks good to me and I sanity tested it on a BCM958300K Cygnus 
combo board.

Thanks,

Reviewed-by: Ray Jui <rjui@broadcom.com>
Tested-by: Ray Jui <rjui@broadcom.com>

WARNING: multiple messages have this Message-ID (diff)
From: rjui@broadcom.com (Ray Jui)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] PCI: iproc: free resource list after registration
Date: Mon, 25 May 2015 17:35:31 -0700	[thread overview]
Message-ID: <5563BFD3.5050902@broadcom.com> (raw)
In-Reply-To: <1432499823-27369-2-git-send-email-hauke@hauke-m.de>

Hi Hauke,

On 15-05-24 01:37 PM, Hauke Mehrtens wrote:
> The resource list is only used in the setup process and was never
> freed. pci_add_resource() allocates a memory area to store the list
> item. This patch fixes the memory leak.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>   drivers/pci/host/pcie-iproc-bcma.c     | 8 ++++----
>   drivers/pci/host/pcie-iproc-platform.c | 8 ++++----
>   2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-iproc-bcma.c b/drivers/pci/host/pcie-iproc-bcma.c
> index f96b39e..2e4f2d6 100644
> --- a/drivers/pci/host/pcie-iproc-bcma.c
> +++ b/drivers/pci/host/pcie-iproc-bcma.c
> @@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev)
>   	pcie->map_irq = iproc_pcie_bcma_map_irq;
>
>   	ret = iproc_pcie_setup(pcie, &res);
> -	if (ret) {
> +	if (ret)
>   		dev_err(pcie->dev, "PCIe controller setup failed\n");
> -		return ret;
> -	}
>
> -	return 0;
> +	pci_free_resource_list(&res);
> +
> +	return ret;
>   }
>
>   static void iproc_pcie_bcma_remove(struct bcma_device *bdev)
> diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c
> index c5fe4c1..9aedc8e 100644
> --- a/drivers/pci/host/pcie-iproc-platform.c
> +++ b/drivers/pci/host/pcie-iproc-platform.c
> @@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
>   	pcie->map_irq = of_irq_parse_and_map_pci;
>
>   	ret = iproc_pcie_setup(pcie, &res);
> -	if (ret) {
> +	if (ret)
>   		dev_err(pcie->dev, "PCIe controller setup failed\n");
> -		return ret;
> -	}
>
> -	return 0;
> +	pci_free_resource_list(&res);
> +
> +	return ret;
>   }
>
>   static int iproc_pcie_pltfm_remove(struct platform_device *pdev)
>

This looks good to me and I sanity tested it on a BCM958300K Cygnus 
combo board.

Thanks,

Reviewed-by: Ray Jui <rjui@broadcom.com>
Tested-by: Ray Jui <rjui@broadcom.com>

  reply	other threads:[~2015-05-26  0:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 20:37 [PATCH 1/2] PCI: iproc: directly add pci resources Hauke Mehrtens
2015-05-24 20:37 ` Hauke Mehrtens
2015-05-24 20:37 ` [PATCH 2/2] PCI: iproc: free resource list after registration Hauke Mehrtens
2015-05-24 20:37   ` Hauke Mehrtens
2015-05-26  0:35   ` Ray Jui [this message]
2015-05-26  0:35     ` Ray Jui
2015-05-25 17:10 ` [PATCH 1/2] PCI: iproc: directly add pci resources Ray Jui
2015-05-25 17:10   ` Ray Jui
2015-05-25 22:48   ` Hauke Mehrtens
2015-05-25 22:48     ` Hauke Mehrtens
2015-05-26  0:32     ` Ray Jui
2015-05-26  0:32       ` Ray Jui
2015-05-27 23:35 ` Bjorn Helgaas
2015-05-27 23:35   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5563BFD3.5050902@broadcom.com \
    --to=rjui@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.