linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Jon Hunter <jonathanh@nvidia.com>
Cc: Vidya Sagar <vidyas@nvidia.com>,
	Zhang Qilong <zhangqilong3@huawei.com>,
	robh@kernel.org, bhelgaas@google.com, thierry.reding@gmail.com,
	linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH] PCI: dwc: fix reference leak in pex_ep_event_pex_rst_deassert
Date: Tue, 23 Mar 2021 10:24:04 +0000	[thread overview]
Message-ID: <20210323102404.GA28718@e121166-lin.cambridge.arm.com> (raw)
In-Reply-To: <fa858756-8fe4-5049-b280-410d225a58a8@nvidia.com>

On Mon, Jan 25, 2021 at 07:30:13PM +0000, Jon Hunter wrote:
> 
> On 03/11/2020 02:52, Vidya Sagar wrote:
> > 
> > 
> > On 11/2/2020 8:00 PM, Zhang Qilong wrote:
> >> External email: Use caution opening links or attachments
> >>
> >>
> >> pm_runtime_get_sync will increment pm usage counter even it
> >> failed. Forgetting to pm_runtime_put_noidle will result in
> >> reference leak in pex_ep_event_pex_rst_deassert, so we should
> >> fix it.
> >>
> >> Fixes: c57247f940e8e ("PCI: tegra: Add support for PCIe endpoint mode
> >> in Tegra194")
> >> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> >> ---
> >>   drivers/pci/controller/dwc/pcie-tegra194.c | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c
> >> b/drivers/pci/controller/dwc/pcie-tegra194.c
> >> index f920e7efe118..936510b5c649 100644
> >> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> >> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> >> @@ -1662,6 +1662,7 @@ static void pex_ep_event_pex_rst_deassert(struct
> >> tegra_pcie_dw *pcie)
> >>
> >>          ret = pm_runtime_get_sync(dev);
> >>          if (ret < 0) {
> >> +               pm_runtime_put_noidle(dev);
> > Why can't we call pm_runtime_put_sync(dev) as that is what is being
> > called in failure cases anyway further down in this API?
> 
> 
> Simply because this is a failure case where the get_sync did not
> complete. So this change is correct, however, now we have
> pm_runtime_resume_and_get(), it is better/simpler just to replace the
> pm_runtime_get_sync with pm_runtime_resume_and_get.

I think this patch slipped through the cracks, should I update the patch
myself with the suggestion above and merge it or you guys prefer sending
it ?

Thanks,
Lorenzo

      reply	other threads:[~2021-03-23 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 14:30 [PATCH] PCI: dwc: fix reference leak in pex_ep_event_pex_rst_deassert Zhang Qilong
2020-11-03  2:52 ` Vidya Sagar
2020-11-03  3:14   ` 答复: " zhangqilong
2021-01-25 16:34     ` Lorenzo Pieralisi
2021-01-27  6:19       ` Vidya Sagar
2021-01-25 19:30   ` Jon Hunter
2021-03-23 10:24     ` Lorenzo Pieralisi [this message]

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=20210323102404.GA28718@e121166-lin.cambridge.arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=jonathanh@nvidia.com \
    --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 \
    --cc=zhangqilong3@huawei.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;
as well as URLs for NNTP newsgroup(s).