public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: zhangsenchuan <zhangsenchuan@eswincomputing.com>
To: "Felix Gu" <ustc.gu@gmail.com>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Yanghui Ou" <ouyanghui@eswincomputing.com>,
	"Yu Ning" <ningyu@eswincomputing.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: eswin: Fix resource leak on dw_pcie_host_init() failure
Date: Fri, 17 Apr 2026 16:49:22 +0800 (GMT+08:00)	[thread overview]
Message-ID: <63f0d797.55eb.19d9aa167da.Coremail.zhangsenchuan@eswincomputing.com> (raw)
In-Reply-To: <20260416-eswin-v1-1-a4991725b5ca@gmail.com>

> Subject: [PATCH] PCI: eswin: Fix resource leak on dw_pcie_host_init() failure
> 
> When dw_pcie_host_init() fails, the code jumps to err_init which
> only calls pm_runtime_put() but skips the clean up of port resources.
> 
> Fixes: b593c26d081a ("PCI: eswin: Add ESWIN PCIe Root Complex driver")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
>  drivers/pci/controller/dwc/pcie-eswin.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-eswin.c b/drivers/pci/controller/dwc/pcie-eswin.c
> index 2845832b3824..0185b55e09e3 100644
> --- a/drivers/pci/controller/dwc/pcie-eswin.c
> +++ b/drivers/pci/controller/dwc/pcie-eswin.c
> @@ -348,7 +348,7 @@ static int eswin_pcie_probe(struct platform_device *pdev)
>  	ret = dw_pcie_host_init(&pci->pp);
>  	if (ret) {
>  		dev_err(dev, "Failed to init host\n");
> -		goto err_init;
> +		goto err_pm_runtime_put;
>  	}
>  
>  	return 0;
> @@ -358,7 +358,6 @@ static int eswin_pcie_probe(struct platform_device *pdev)
>  		reset_control_put(port->perst);
>  		list_del(&port->list);
>  	}
> -err_init:
>  	pm_runtime_put(dev);
>  
>  	return ret;

Thanks for your reminder.
In some cases, resources are indeed unable to be released. For instance, if the 
clk_bulk_prepare_enable function fails to execute, or if some functions 
in dw_pcie_host_init fail to execute, and the port resources are not released.

Kind regards,
Senchuan
> 
> ---
> base-commit: 936c21068d7ade00325e40d82bfd2f3f29d9f659
> change-id: 20260416-eswin-4d09df4e8f48
> 


  parent reply	other threads:[~2026-04-17  8:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 12:30 [PATCH] PCI: eswin: Fix resource leak on dw_pcie_host_init() failure Felix Gu
2026-04-17  8:02 ` Markus Elfring
2026-04-17  8:49 ` zhangsenchuan [this message]
2026-04-17  9:34 ` Manivannan Sadhasivam
2026-04-17 10:14   ` Felix Gu

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=63f0d797.55eb.19d9aa167da.Coremail.zhangsenchuan@eswincomputing.com \
    --to=zhangsenchuan@eswincomputing.com \
    --cc=bhelgaas@google.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=ningyu@eswincomputing.com \
    --cc=ouyanghui@eswincomputing.com \
    --cc=robh@kernel.org \
    --cc=ustc.gu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox