[PATCH] [phy/marvell] phy-pxa-28nm-usb2: Add error handling
Haoran Liu
liuhaoran14 at 163.com
Wed Nov 29 04:24:57 PST 2023
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 at 163.com>
---
drivers/phy/marvell/phy-pxa-28nm-usb2.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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) &
--
2.17.1
More information about the linux-phy
mailing list