mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
phy: sunplus: fix error handling in sp_uphy_init()
Fix the error paths of sp_uphy_init() to undo exactly what each stage
did: return directly if clk_prepare_enable() fails, release only the clock
if reset_control_deassert() fails, and jump to err_reset if
update_disc_vol() fails so the clock and reset are not leaked.
Fixes: 99d9ccd973 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patch.msgid.link/20260803-sunplus-usb3-v1-1-5a562524c869@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
b780b8929c
commit
8b2683bc4c
|
|
@ -116,11 +116,11 @@ static int sp_uphy_init(struct phy *phy)
|
|||
|
||||
ret = clk_prepare_enable(usbphy->phy_clk);
|
||||
if (ret)
|
||||
goto err_clk;
|
||||
return ret;
|
||||
|
||||
ret = reset_control_deassert(usbphy->rstc);
|
||||
if (ret)
|
||||
goto err_reset;
|
||||
goto err_clk;
|
||||
|
||||
/* Default value modification */
|
||||
writel(HIGH_MASK_BITS | 0x4002, usbphy->moon4_regs + UPHY_CONTROL0);
|
||||
|
|
@ -129,7 +129,7 @@ static int sp_uphy_init(struct phy *phy)
|
|||
/* disconnect voltage */
|
||||
ret = update_disc_vol(usbphy);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto err_reset;
|
||||
|
||||
/* board uphy 0 internal register modification for tid certification */
|
||||
val = readl(usbphy->phy_regs + CONFIG9);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user