Commit 8387c576 authored by Vivek Gautam's avatar Vivek Gautam Committed by Kishon Vijay Abraham I

phy: qcom-qmp: Fix failure path in phy_init functions

Fixing the clk enable failure path in qcom_qmp_phy_init()
and cleanup the reset control deassertion failure path in
qcom_qmp_phy_com_init().

Fixes: e78f3d15 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")

Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarVivek Gautam <vivek.gautam@codeaurora.org>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent eef243d0
...@@ -775,8 +775,6 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp) ...@@ -775,8 +775,6 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
if (ret) { if (ret) {
dev_err(qmp->dev, "%s reset deassert failed\n", dev_err(qmp->dev, "%s reset deassert failed\n",
qmp->cfg->reset_list[i]); qmp->cfg->reset_list[i]);
while (--i >= 0)
reset_control_assert(qmp->resets[i]);
goto err_rst; goto err_rst;
} }
} }
...@@ -805,7 +803,7 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp) ...@@ -805,7 +803,7 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
if (ret) { if (ret) {
dev_err(qmp->dev, dev_err(qmp->dev,
"phy common block init timed-out\n"); "phy common block init timed-out\n");
goto err_com_init; goto err_rst;
} }
} }
...@@ -813,11 +811,11 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp) ...@@ -813,11 +811,11 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
return 0; return 0;
err_com_init: err_rst:
while (--i >= 0) while (--i >= 0)
reset_control_assert(qmp->resets[i]); reset_control_assert(qmp->resets[i]);
err_rst:
mutex_unlock(&qmp->phy_mutex); mutex_unlock(&qmp->phy_mutex);
return ret; return ret;
} }
...@@ -870,14 +868,13 @@ static int qcom_qmp_phy_init(struct phy *phy) ...@@ -870,14 +868,13 @@ static int qcom_qmp_phy_init(struct phy *phy)
if (ret) { if (ret) {
dev_err(qmp->dev, "failed to enable %s clk, err=%d\n", dev_err(qmp->dev, "failed to enable %s clk, err=%d\n",
qmp->cfg->clk_list[i], ret); qmp->cfg->clk_list[i], ret);
while (--i >= 0) goto err_clk;
clk_disable_unprepare(qmp->clks[i]);
} }
} }
ret = qcom_qmp_phy_com_init(qmp); ret = qcom_qmp_phy_com_init(qmp);
if (ret) if (ret)
goto err_com_init; goto err_clk;
if (cfg->has_lane_rst) { if (cfg->has_lane_rst) {
ret = reset_control_deassert(qphy->lane_rst); ret = reset_control_deassert(qphy->lane_rst);
...@@ -925,7 +922,7 @@ static int qcom_qmp_phy_init(struct phy *phy) ...@@ -925,7 +922,7 @@ static int qcom_qmp_phy_init(struct phy *phy)
reset_control_assert(qphy->lane_rst); reset_control_assert(qphy->lane_rst);
err_lane_rst: err_lane_rst:
qcom_qmp_phy_com_exit(qmp); qcom_qmp_phy_com_exit(qmp);
err_com_init: err_clk:
while (--i >= 0) while (--i >= 0)
clk_disable_unprepare(qmp->clks[i]); clk_disable_unprepare(qmp->clks[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment