diff mbox series

[4/5] usb: dwc2: get optional clock by devm_clk_get_optional()

Message ID e14524a4e6b38140f41e55bb74aedb6599e963e1.1553937592.git.chunfeng.yun@mediatek.com (mailing list archive)
State Superseded
Commit 60722c4eefbc9acddaf5e641f6dfb24bce930f9a
Headers show
Series [1/5] usb: xhci-mtk: get optional clock by devm_clk_get_optional() | expand

Commit Message

Chunfeng Yun March 30, 2019, 9:28 a.m. UTC
Use devm_clk_get_optional() to get optional clock

Cc: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/dwc2/platform.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Minas Harutyunyan April 1, 2019, 8:47 a.m. UTC | #1
On 3/30/2019 1:28 PM, Chunfeng Yun wrote:
> 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>

> ---
>   drivers/usb/dwc2/platform.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index c0b64d483552..9aa9682a5cd2 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -284,10 +284,10 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
>   	}
>   
>   	/* Clock */
> -	hsotg->clk = devm_clk_get(hsotg->dev, "otg");
> +	hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
>   	if (IS_ERR(hsotg->clk)) {
> -		hsotg->clk = NULL;
> -		dev_dbg(hsotg->dev, "cannot get otg clock\n");
> +		dev_err(hsotg->dev, "cannot get otg clock\n");
> +		return PTR_ERR(hsotg->clk);
>   	}
>   
>   	/* Regulators */
>
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index c0b64d483552..9aa9682a5cd2 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -284,10 +284,10 @@  static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
 	}
 
 	/* Clock */
-	hsotg->clk = devm_clk_get(hsotg->dev, "otg");
+	hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
 	if (IS_ERR(hsotg->clk)) {
-		hsotg->clk = NULL;
-		dev_dbg(hsotg->dev, "cannot get otg clock\n");
+		dev_err(hsotg->dev, "cannot get otg clock\n");
+		return PTR_ERR(hsotg->clk);
 	}
 
 	/* Regulators */