Skip to contentSkip to conversation

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

PATCH In review Vivek Gautam 2 participants 4 messages Jun 20, 2017 – Aug 2, 2017

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

PATCH 1/1 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 e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Cc Kishon Vijay Abraham I <[email protected]>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp.c +6 -9
index 78ca62897784..7b739571b301 100644
@@ -654,8 +654,6 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
 		if (ret) {
 			dev_err(qmp->dev, "%s reset deassert failed\n",
 				qmp->cfg->reset_list[i]);
-			while (--i >= 0)
-				reset_control_assert(qmp->resets[i]);
 			goto err_rst;
 		}
 	}
@@ -684,7 +682,7 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
 		if (ret) {
 			dev_err(qmp->dev,
 				"phy common block init timed-out\n");
-			goto err_com_init;
+			goto err_rst;
 		}
 	}
 
@@ -692,11 +690,11 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
 
 	return 0;
 
-err_com_init:
+err_rst:
 	while (--i >= 0)
 		reset_control_assert(qmp->resets[i]);
-err_rst:
 	mutex_unlock(&qmp->phy_mutex);
+
 	return ret;
 }
 
@@ -749,14 +747,13 @@ static int qcom_qmp_phy_init(struct phy *phy)
 		if (ret) {
 			dev_err(qmp->dev, "failed to enable %s clk, err=%d\n",
 				qmp->cfg->clk_list[i], ret);
-			while (--i >= 0)
-				clk_disable_unprepare(qmp->clks[i]);
+			goto err_clk;
 		}
 	}
 
 	ret = qcom_qmp_phy_com_init(qmp);
 	if (ret)
-		goto err_com_init;
+		goto err_clk;
 
 	if (cfg->has_lane_rst) {
 		ret = reset_control_deassert(qphy->lane_rst);
@@ -804,7 +801,7 @@ static int qcom_qmp_phy_init(struct phy *phy)
 		reset_control_assert(qphy->lane_rst);
 err_lane_rst:
 	qcom_qmp_phy_com_exit(qmp);
-err_com_init:
+err_clk:
 	while (--i >= 0)
 		clk_disable_unprepare(qmp->clks[i]);
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

Hi Kishon,

Quoted 8 lines · Vivek Gautam

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 e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Cc Kishon Vijay Abraham I <[email protected]>

This patch got missed. Can you please pull this in?

regards
Vivek

Quoted 70 lines
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp.c +6 -10
index 78ca62897784..7b739571b301 100644
@@ -654,8 +654,6 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
                if (ret) {
                        dev_err(qmp->dev, "%s reset deassert failed\n",
                                qmp->cfg->reset_list[i]);
-                       while (--i >= 0)
-                               reset_control_assert(qmp->resets[i]);
                        goto err_rst;
                }
        }
@@ -684,7 +682,7 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
                if (ret) {
                        dev_err(qmp->dev,
                                "phy common block init timed-out\n");
-                       goto err_com_init;
+                       goto err_rst;
                }
        }
 
@@ -692,11 +690,11 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
 
        return 0;
 
-err_com_init:
+err_rst:
        while (--i >= 0)
                reset_control_assert(qmp->resets[i]);
-err_rst:
        mutex_unlock(&qmp->phy_mutex);
+
        return ret;
 }
 
@@ -749,14 +747,13 @@ static int qcom_qmp_phy_init(struct phy *phy)
                if (ret) {
                        dev_err(qmp->dev, "failed to enable %s clk, err=%d\n",
                                qmp->cfg->clk_list[i], ret);
-                       while (--i >= 0)
-                               clk_disable_unprepare(qmp->clks[i]);
+                       goto err_clk;
                }
        }
 
        ret = qcom_qmp_phy_com_init(qmp);
        if (ret)
-               goto err_com_init;
+               goto err_clk;
 
        if (cfg->has_lane_rst) {
                ret = reset_control_deassert(qphy->lane_rst);
@@ -804,7 +801,7 @@ static int qcom_qmp_phy_init(struct phy *phy)
                reset_control_assert(qphy->lane_rst);
 err_lane_rst:
        qcom_qmp_phy_com_exit(qmp);
-err_com_init:
+err_clk:
        while (--i >= 0)
                clk_disable_unprepare(qmp->clks[i]);
 
--

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

Vivek,

Quoted 9 lines · Vivek Gautam

Hi Kishon,

Quoted 4 lines · Vivek Gautam

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().

Quoted 6 lines
Quoted 4 lines
Fixes e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Cc Kishon Vijay Abraham I <[email protected]>

This patch got missed. Can you please pull this in?

merged now, thanks!

-Kishon

Quoted 77 lines

regards
Vivek

Quoted 70 lines
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp.c +6 -10
index 78ca62897784..7b739571b301 100644
@@ -654,8 +654,6 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
                if (ret) {
                        dev_err(qmp->dev, "%s reset deassert failed\n",
                                qmp->cfg->reset_list[i]);
-                       while (--i >= 0)
-                               reset_control_assert(qmp->resets[i]);
                        goto err_rst;
                }
        }
@@ -684,7 +682,7 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
                if (ret) {
                        dev_err(qmp->dev,
                                "phy common block init timed-out\n");
-                       goto err_com_init;
+                       goto err_rst;
                }
        }
 
@@ -692,11 +690,11 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
 
        return 0;
 
-err_com_init:
+err_rst:
        while (--i >= 0)
                reset_control_assert(qmp->resets[i]);
-err_rst:
        mutex_unlock(&qmp->phy_mutex);
+
        return ret;
 }
 
@@ -749,14 +747,13 @@ static int qcom_qmp_phy_init(struct phy *phy)
                if (ret) {
                        dev_err(qmp->dev, "failed to enable %s clk, err=%d\n",
                                qmp->cfg->clk_list[i], ret);
-                       while (--i >= 0)
-                               clk_disable_unprepare(qmp->clks[i]);
+                       goto err_clk;
                }
        }
 
        ret = qcom_qmp_phy_com_init(qmp);
        if (ret)
-               goto err_com_init;
+               goto err_clk;
 
        if (cfg->has_lane_rst) {
                ret = reset_control_deassert(qphy->lane_rst);
@@ -804,7 +801,7 @@ static int qcom_qmp_phy_init(struct phy *phy)
                reset_control_assert(qphy->lane_rst);
 err_lane_rst:
        qcom_qmp_phy_com_exit(qmp);
-err_com_init:
+err_clk:
        while (--i >= 0)
                clk_disable_unprepare(qmp->clks[i]);
 
--

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

#3 lore raw
Quoted 12 lines · Kishon Vijay Abraham I

Vivek,

Quoted 9 lines · Vivek Gautam

Hi Kishon,

Quoted 4 lines · Vivek Gautam

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().

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Fixes e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Cc Kishon Vijay Abraham I <[email protected]>

This patch got missed. Can you please pull this in?

merged now, thanks!

Thanks Kishon.

regards
Vivek

Quoted 83 lines

-Kishon

Quoted 70 lines

regards
Vivek

Quoted 66 lines
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp.c +6 -9
index 78ca62897784..7b739571b301 100644
@@ -654,8 +654,6 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
                if (ret) {
                        dev_err(qmp->dev, "%s reset deassert failed\n",
                                qmp->cfg->reset_list[i]);
-                       while (--i >= 0)
-                               reset_control_assert(qmp->resets[i]);
                        goto err_rst;
                }
        }
@@ -684,7 +682,7 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
                if (ret) {
                        dev_err(qmp->dev,
                                "phy common block init timed-out\n");
-                       goto err_com_init;
+                       goto err_rst;
                }
        }
 
@@ -692,11 +690,11 @@ static int qcom_qmp_phy_com_init(struct qcom_qmp *qmp)
 
        return 0;
 
-err_com_init:
+err_rst:
        while (--i >= 0)
                reset_control_assert(qmp->resets[i]);
-err_rst:
        mutex_unlock(&qmp->phy_mutex);
+
        return ret;
 }
 
@@ -749,14 +747,13 @@ static int qcom_qmp_phy_init(struct phy *phy)
                if (ret) {
                        dev_err(qmp->dev, "failed to enable %s clk, err=%d\n",
                                qmp->cfg->clk_list[i], ret);
-                       while (--i >= 0)
-                               clk_disable_unprepare(qmp->clks[i]);
+                       goto err_clk;
                }
        }
 
        ret = qcom_qmp_phy_com_init(qmp);
        if (ret)
-               goto err_com_init;
+               goto err_clk;
 
        if (cfg->has_lane_rst) {
                ret = reset_control_deassert(qphy->lane_rst);
@@ -804,7 +801,7 @@ static int qcom_qmp_phy_init(struct phy *phy)
                reset_control_assert(qphy->lane_rst);
 err_lane_rst:
        qcom_qmp_phy_com_exit(qmp);
-err_com_init:
+err_clk:
        while (--i >= 0)
                clk_disable_unprepare(qmp->clks[i]);
 
Quoted 7 lines
Quoted 4 lines

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project