diff mbox series

[V4,5/6] PCI: tegra: Check return value of tegra_pcie_init_controller()

Message ID 20201109171937.28326-6-vidyas@nvidia.com
State Deferred
Headers show
Series Enhancements to Tegra194 PCIe driver | expand

Commit Message

Vidya Sagar Nov. 9, 2020, 5:19 p.m. UTC
The return value of tegra_pcie_init_controller() must be checked before
PCIe link up check and registering debugfs entries subsequently as it
doesn't make sense to do these when the controller initialization itself
has failed.

Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
---
V4:
* None

V3:
* New patch in this series

 drivers/pci/controller/dwc/pcie-tegra194.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Thierry Reding Nov. 26, 2020, 11:34 a.m. UTC | #1
On Mon, Nov 09, 2020 at 10:49:36PM +0530, Vidya Sagar wrote:
> The return value of tegra_pcie_init_controller() must be checked before
> PCIe link up check and registering debugfs entries subsequently as it
> doesn't make sense to do these when the controller initialization itself
> has failed.
> 
> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
> ---
> V4:
> * None
> 
> V3:
> * New patch in this series
> 
>  drivers/pci/controller/dwc/pcie-tegra194.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 9be10c8953df..8c08998b9ce1 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1579,7 +1579,11 @@  static int tegra_pcie_config_rp(struct tegra_pcie_dw *pcie)
 		goto fail_pm_get_sync;
 	}
 
-	tegra_pcie_init_controller(pcie);
+	ret = tegra_pcie_init_controller(pcie);
+	if (ret < 0) {
+		dev_err(dev, "Failed to initialize controller: %d\n", ret);
+		goto fail_pm_get_sync;
+	}
 
 	pcie->link_state = tegra_pcie_dw_link_up(&pcie->pci);
 	if (!pcie->link_state) {