diff mbox series

PCI: tegra194: Fix PM error handling in tegra_pcie_config_ep

Message ID 20220602031910.55859-1-linmq006@gmail.com (mailing list archive)
State Accepted
Commit e8fbd344a5ea62663554b8546b6bf9f88b93785a
Headers show
Series PCI: tegra194: Fix PM error handling in tegra_pcie_config_ep | expand

Commit Message

Miaoqian Lin June 2, 2022, 3:19 a.m. UTC
The pm_runtime_enable() will increase power disable depth.
if dw_pcie_ep_init() fails, we should use pm_runtime_disable()
to balance it pm_runtime_enable().
Add missing pm_runtime_disable() for tegra_pcie_config_ep()

Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/pci/controller/dwc/pcie-tegra194.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Vidya Sagar June 2, 2022, 11:34 a.m. UTC | #1
Thanks for pushing the change.

Reviewed-by: Vidya Sagar <vidyas@nvidia.com>

On 6/2/2022 8:49 AM, Miaoqian Lin wrote:
> External email: Use caution opening links or attachments
> 
> 
> The pm_runtime_enable() will increase power disable depth.
> if dw_pcie_ep_init() fails, we should use pm_runtime_disable()
> to balance it pm_runtime_enable().
> Add missing pm_runtime_disable() for tegra_pcie_config_ep()
> 
> Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.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 cc2678490162..d992371a36e6 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1949,6 +1949,7 @@ static int tegra_pcie_config_ep(struct tegra194_pcie *pcie,
>          if (ret) {
>                  dev_err(dev, "Failed to initialize DWC Endpoint subsystem: %d\n",
>                          ret);
> +               pm_runtime_disable(dev);
>                  return ret;
>          }
> 
> --
> 2.25.1
>
Bjorn Helgaas June 8, 2022, 9:18 p.m. UTC | #2
On Thu, Jun 02, 2022 at 07:19:08AM +0400, Miaoqian Lin wrote:
> The pm_runtime_enable() will increase power disable depth.
> if dw_pcie_ep_init() fails, we should use pm_runtime_disable()
> to balance it pm_runtime_enable().
> Add missing pm_runtime_disable() for tegra_pcie_config_ep()
> 
> Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Applied with Vidya's ack to pci/ctrl/tegra194 for v5.20, thanks!

> ---
>  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 cc2678490162..d992371a36e6 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1949,6 +1949,7 @@ static int tegra_pcie_config_ep(struct tegra194_pcie *pcie,
>  	if (ret) {
>  		dev_err(dev, "Failed to initialize DWC Endpoint subsystem: %d\n",
>  			ret);
> +		pm_runtime_disable(dev);
>  		return ret;
>  	}
>  
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index cc2678490162..d992371a36e6 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1949,6 +1949,7 @@  static int tegra_pcie_config_ep(struct tegra194_pcie *pcie,
 	if (ret) {
 		dev_err(dev, "Failed to initialize DWC Endpoint subsystem: %d\n",
 			ret);
+		pm_runtime_disable(dev);
 		return ret;
 	}