aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorChuanjia Liu2020-08-31 15:53:12 +0800
committerTom Rini2020-09-10 11:17:46 -0400
commitdf85e9576c18e868c7d42c224a0967cd31f489c0 (patch)
tree180f777507a3b243bc9b4e9def59ae8726f29f28 /drivers/pci
parenta5fc58734fbc8b6f61b7716df3367d4607c168c4 (diff)
PCI: mediatek: Release the resource when PCIe enable port fail
On the mt7623 platform, if one port enable fail and other port enable succeed. It will hang on when using pci enum because the resource was not released correctly. Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com> Tested-by: Frank Wunderlich <frank-w@public-files.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie_mediatek.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
index ad34f7c597e..55b6a40f254 100644
--- a/drivers/pci/pcie_mediatek.c
+++ b/drivers/pci/pcie_mediatek.c
@@ -443,29 +443,36 @@ static void mtk_pcie_enable_port(struct mtk_pcie_port *port)
err = clk_enable(&port->sys_ck);
if (err)
- goto exit;
+ goto err_sys_clk;
err = reset_assert(&port->reset);
if (err)
- goto exit;
+ goto err_reset;
err = reset_deassert(&port->reset);
if (err)
- goto exit;
+ goto err_reset;
err = generic_phy_init(&port->phy);
if (err)
- goto exit;
+ goto err_phy_init;
err = generic_phy_power_on(&port->phy);
if (err)
- goto exit;
+ goto err_phy_on;
if (!mtk_pcie_startup_port(port))
return;
pr_err("Port%d link down\n", port->slot);
-exit:
+
+ generic_phy_power_off(&port->phy);
+err_phy_on:
+ generic_phy_exit(&port->phy);
+err_phy_init:
+err_reset:
+ clk_disable(&port->sys_ck);
+err_sys_clk:
mtk_pcie_port_free(port);
}