Skip to contentSkip to conversation

PCI: tegra194: Fix PM error handling in tegra_pcie_config_ep

PATCH In review Miaoqian Lin 3 participants 3 messages Jun 2, 2022 – Jun 8, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: tegra194: Fix PM error handling in tegra_pcie_config_ep

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")
---
 drivers/pci/controller/dwc/pcie-tegra194.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-tegra194.c +1 -0
index cc2678490162..d992371a36e6 100644
@@ -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;
 	}
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Thanks for pushing the change.

Quoted 29 lines · Miaoqian Lin

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")
---
  drivers/pci/controller/dwc/pcie-tegra194.c | 1 +
  1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-tegra194.c +1 -1
index cc2678490162..d992371a36e6 100644
@@ -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

#2 lore raw
In reply to Miaoqian Lin
Quoted 7 lines · Miaoqian Lin

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")

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

Quoted 19 lines
---
 drivers/pci/controller/dwc/pcie-tegra194.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-tegra194.c +1 -0
index cc2678490162..d992371a36e6 100644
@@ -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;
 	}
 
Signature · 1 line
2.25.1