Skip to content

Commit 7c113f7

Browse files
Fabio EstevamFelipe Balbi
authored andcommitted
usb: phy: phy-generic: Check clk_prepare_enable() error
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of failure. Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent b2f1eaa commit 7c113f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/usb/phy/phy-generic.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,18 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
144144
int usb_gen_phy_init(struct usb_phy *phy)
145145
{
146146
struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
147+
int ret;
147148

148149
if (!IS_ERR(nop->vcc)) {
149150
if (regulator_enable(nop->vcc))
150151
dev_err(phy->dev, "Failed to enable power\n");
151152
}
152153

153-
if (!IS_ERR(nop->clk))
154-
clk_prepare_enable(nop->clk);
154+
if (!IS_ERR(nop->clk)) {
155+
ret = clk_prepare_enable(nop->clk);
156+
if (ret)
157+
return ret;
158+
}
155159

156160
nop_reset(nop);
157161

0 commit comments

Comments
 (0)