Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc2: remove early return on clock query

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>

authored by

Dinh Nguyen and committed by
Felipe Balbi
f415fbd1 da9f3289

+7 -3
+7 -3
drivers/usb/dwc2/gadget.c
··· 3451 3451 hsotg->clk = devm_clk_get(dev, "otg"); 3452 3452 if (IS_ERR(hsotg->clk)) { 3453 3453 hsotg->clk = NULL; 3454 - dev_err(dev, "cannot get otg clock\n"); 3455 - return PTR_ERR(hsotg->clk); 3454 + dev_dbg(dev, "cannot get otg clock\n"); 3456 3455 } 3457 3456 3458 3457 hsotg->gadget.max_speed = USB_SPEED_HIGH; ··· 3460 3461 3461 3462 /* reset the system */ 3462 3463 3463 - clk_prepare_enable(hsotg->clk); 3464 + ret = clk_prepare_enable(hsotg->clk); 3465 + if (ret) { 3466 + dev_err(dev, "failed to enable otg clk\n"); 3467 + goto err_clk; 3468 + } 3469 + 3464 3470 3465 3471 /* regulators */ 3466 3472