Skip to content

Commit

Permalink
usb: phy: phy-generic: Check clk_prepare_enable() error
Browse files Browse the repository at this point in the history
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 <fabio.estevam@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Fabio Estevam authored and Felipe Balbi committed Sep 5, 2016
1 parent b2f1eaa commit 7c113f7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/usb/phy/phy-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,18 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
int usb_gen_phy_init(struct usb_phy *phy)
{
struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
int ret;

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

if (!IS_ERR(nop->clk))
clk_prepare_enable(nop->clk);
if (!IS_ERR(nop->clk)) {
ret = clk_prepare_enable(nop->clk);
if (ret)
return ret;
}

nop_reset(nop);

Expand Down

0 comments on commit 7c113f7

Please sign in to comment.