Re: 答复: [PATCH] PCI: dwc: fix reference leak in pex_ep_event_pex_rst_deassert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 03, 2020 at 03:14:21AM +0000, zhangqilong wrote:
> Hi
> 
> > 
> > 
> > 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@xxxxxxxxxx>
> > > ---
> > >   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?
> > 
> Both of the two functions are OK, the difference is that, when pm_runtime_put_sync failed(runtime of the device has error, the device is in Inaccessible state or other error state...), it only increase the usage count of the power, and do nothing else. We merely need call pm_runtime_put_noidle to decrease the usage count. If we call pm_runtime_put_sync to reset it, it will notify device bus type if the device can be suspended, and that is meanless when pm_runtime_put_sync failed.

I don't understand. Vidya any feedback ?

Lorenzo

> Thanks, best wish!
> 
> Zhang Qilong
> > >                  dev_err(dev, "Failed to get runtime sync for PCIe
> > dev: %d\n",
> > >                          ret);
> > >                  return;
> > > --
> > > 2.17.1
> > >



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux