All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	thierry.reding@gmail.com
Cc: robh@kernel.org, bhelgaas@google.com, jonathanh@nvidia.com,
	linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	vidyas@nvidia.com
Subject: Re: [PATCH 1/3] PCI: tegra: Fix OF node reference leak
Date: Tue, 22 Jun 2021 11:42:10 +0100	[thread overview]
Message-ID: <20210622104145.GA24565@lpieralisi> (raw)
In-Reply-To: <55b11e9a7fa2987fbc0869d68ae59888954d65e2.1620148539.git.christophe.jaillet@wanadoo.fr>

On Tue, May 04, 2021 at 07:17:42PM +0200, Christophe JAILLET wrote:
> Commit 9e38e690ace3 ("PCI: tegra: Fix OF node reference leak") has fixed
> some node reference leaks in this function but missed some of them.
> 
> In fact, having 'port' referenced in the 'rp' structure is not enough to
> prevent the leak, until 'rp' is actually added in the 'pcie->ports' list.
> 
> Add the missing 'goto err_node_put' accordingly.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/pci/controller/pci-tegra.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)

Thierry, Jon, Vidya,

please review this series when you have time, thanks.

Lorenzo

> diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
> index 8069bd9232d4..006bf0346dec 100644
> --- a/drivers/pci/controller/pci-tegra.c
> +++ b/drivers/pci/controller/pci-tegra.c
> @@ -2193,13 +2193,15 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
>  		rp->np = port;
>  
>  		rp->base = devm_pci_remap_cfg_resource(dev, &rp->regs);
> -		if (IS_ERR(rp->base))
> -			return PTR_ERR(rp->base);
> +		if (IS_ERR(rp->base)) {
> +			err = PTR_ERR(rp->base);
> +			goto err_node_put;
> +		}
>  
>  		label = devm_kasprintf(dev, GFP_KERNEL, "pex-reset-%u", index);
>  		if (!label) {
> -			dev_err(dev, "failed to create reset GPIO label\n");
> -			return -ENOMEM;
> +			err = -ENOMEM;
> +			goto err_node_put;
>  		}
>  
>  		/*
> @@ -2217,7 +2219,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
>  			} else {
>  				dev_err(dev, "failed to get reset GPIO: %ld\n",
>  					PTR_ERR(rp->reset_gpio));
> -				return PTR_ERR(rp->reset_gpio);
> +				err = PTR_ERR(rp->reset_gpio);
> +				goto err_node_put;
>  			}
>  		}
>  
> -- 
> 2.30.2
> 

  parent reply	other threads:[~2021-06-22 10:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 17:17 [PATCH 1/3] PCI: tegra: Fix OF node reference leak Christophe JAILLET
2021-05-04 17:17 ` [PATCH 2/3] PCI: tegra: Use 'seq_puts' instead of 'seq_printf' Christophe JAILLET
2021-07-05 17:01   ` Vidya Sagar
2021-05-04 17:18 ` [PATCH 3/3] PCI: tegra: make const array err_msg static Christophe JAILLET
2021-07-05 17:01   ` Vidya Sagar
2021-07-05 22:31   ` Krzysztof Wilczyński
2021-07-07 18:24     ` Christophe JAILLET
2021-07-07 19:52       ` Krzysztof Wilczyński
2021-06-22 10:42 ` Lorenzo Pieralisi [this message]
2021-07-05 17:00 ` [PATCH 1/3] PCI: tegra: Fix OF node reference leak Vidya Sagar
2021-08-05 10:43 ` Lorenzo Pieralisi

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=20210622104145.GA24565@lpieralisi \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=jonathanh@nvidia.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=vidyas@nvidia.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.