Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: qcom: m31: propagate reset errors
@ 2026-08-30 13:14 Pengpeng Hou
  2026-09-01  9:45 ` Konrad Dybcio
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pengpeng Hou @ 2026-08-30 13:14 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Pengpeng Hou, Neil Armstrong, Manivannan Sadhasivam,
	Philipp Zabel, linux-arm-msm, linux-phy, linux-kernel

m31usb_phy_init() enables the regulator and clock, then performs an
unchecked
reset pulse before reporting that the PHY powered on.

Return reset-controller errors and release the clock and regulator that
were
enabled for the failed power-on attempt.

Fixes: 08e49af50701 ("phy: qcom: Introduce M31 USB PHY driver")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/phy/qualcomm/phy-qcom-m31.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-m31.c b/drivers/phy/qualcomm/phy-qcom-m31.c
index 168ea980fda03..f46c7ec87496a 100644
--- a/drivers/phy/qualcomm/phy-qcom-m31.c
+++ b/drivers/phy/qualcomm/phy-qcom-m31.c
@@ -228,9 +228,14 @@ static int m31usb_phy_init(struct phy *phy)
 	}
 
 	/* Perform phy reset */
-	reset_control_assert(qphy->reset);
+	ret = reset_control_assert(qphy->reset);
+	if (ret)
+		goto disable_clk;
+
 	udelay(5);
-	reset_control_deassert(qphy->reset);
+	ret = reset_control_deassert(qphy->reset);
+	if (ret)
+		goto disable_clk;
 
 	/* configure for ULPI mode if requested */
 	if (qphy->ulpi_mode)
@@ -247,6 +252,12 @@ static int m31usb_phy_init(struct phy *phy)
 	}
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(qphy->clk);
+	regulator_disable(qphy->vreg);
+
+	return ret;
 }
 
 static int m31usb_phy_shutdown(struct phy *phy)

base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
-- 
2.50.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-01 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 13:14 [PATCH] phy: qcom: m31: propagate reset errors Pengpeng Hou
2026-09-01  9:45 ` Konrad Dybcio
2026-09-01 12:22 ` Abel Vesa
2026-09-01 15:43 ` Krishna Kurapati

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox