diff mbox series

[phy/marvell] phy-pxa-28nm-usb2: Add error handling

Message ID 20231129122457.33413-1-liuhaoran14@163.com
State Changes Requested
Headers show
Series [phy/marvell] phy-pxa-28nm-usb2: Add error handling | expand

Commit Message

Haoran Liu Nov. 29, 2023, 12:24 p.m. UTC
This patch adds error handling to the mv_usb2_phy_28nm_init
function in drivers/phy/marvell/phy-pxa-28nm-usb2.c. The
function previously did not handle the potential failure of
the clk_prepare_enable call, which could result in unexpected
behavior if clock preparation failed.

Signed-off-by: Haoran Liu <liuhaoran14@163.com>
---
 drivers/phy/marvell/phy-pxa-28nm-usb2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/phy/marvell/phy-pxa-28nm-usb2.c b/drivers/phy/marvell/phy-pxa-28nm-usb2.c
index 64afb82cf70e..93fea4f246a2 100644
--- a/drivers/phy/marvell/phy-pxa-28nm-usb2.c
+++ b/drivers/phy/marvell/phy-pxa-28nm-usb2.c
@@ -154,7 +154,11 @@  static int mv_usb2_phy_28nm_init(struct phy *phy)
 	u32 reg;
 	int ret;
 
-	clk_prepare_enable(mv_phy->clk);
+	ret = clk_prepare_enable(mv_phy->clk);
+	if (ret) {
+		dev_err(&phy->dev, "Failed to enable clock: %d\n", ret);
+		return ret;
+	}
 
 	/* PHY_28NM_PLL_REG0 */
 	reg = readl(base + PHY_28NM_PLL_REG0) &