usb: dwc2: remove early return on clock query
authorDinh Nguyen <dinguyen@opensource.altera.com>
Mon, 24 Nov 2014 17:02:11 +0000 (11:02 -0600)
committerFelipe Balbi <balbi@ti.com>
Tue, 25 Nov 2014 14:47:05 +0000 (08:47 -0600)
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>
drivers/usb/dwc2/gadget.c

index 05b05221d6776ebb9c975a1e46289c95b5d3ed71..407f55cf83aa59eaca8c1997b5fb8b336e41b6e0 100644 (file)
@@ -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;
@@ -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 */