Skip to content

Commit e894cdc

Browse files
Chunfeng Yungregkh
authored andcommitted
usb: dwc2: get optional clock by devm_clk_get_optional()
When the driver tries to get optional clock, it ignores all errors, but if only ignores -ENOENT, it will cover some real errors, such as -EPROBE_DEFER, so use devm_clk_get_optional() to get optional clock. Cc: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bbe2028 commit e894cdc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/dwc2/platform.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
284284
}
285285

286286
/* Clock */
287-
hsotg->clk = devm_clk_get(hsotg->dev, "otg");
287+
hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
288288
if (IS_ERR(hsotg->clk)) {
289-
hsotg->clk = NULL;
290-
dev_dbg(hsotg->dev, "cannot get otg clock\n");
289+
dev_err(hsotg->dev, "cannot get otg clock\n");
290+
return PTR_ERR(hsotg->clk);
291291
}
292292

293293
/* Regulators */

0 commit comments

Comments
 (0)