Skip to content

Commit

Permalink
usb: dwc2: remove early return on clock query
Browse files Browse the repository at this point in the history
Since we have assigned clk=NULL, which is a valid clk, we should not
be returning when a clock node is not provide. Instead, we should return
only when we cannot enable the clock.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Dinh Nguyen authored and Felipe Balbi committed Nov 25, 2014
1 parent da9f328 commit f415fbd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/usb/dwc2/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -3451,8 +3451,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
hsotg->clk = devm_clk_get(dev, "otg");
if (IS_ERR(hsotg->clk)) {
hsotg->clk = NULL;
dev_err(dev, "cannot get otg clock\n");
return PTR_ERR(hsotg->clk);
dev_dbg(dev, "cannot get otg clock\n");
}

hsotg->gadget.max_speed = USB_SPEED_HIGH;
Expand All @@ -3461,7 +3460,12 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)

/* reset the system */

clk_prepare_enable(hsotg->clk);
ret = clk_prepare_enable(hsotg->clk);
if (ret) {
dev_err(dev, "failed to enable otg clk\n");
goto err_clk;
}


/* regulators */

Expand Down

0 comments on commit f415fbd

Please sign in to comment.