usb: chipidea: usb2: make clock optional

Allow clock to be missing from DT (assume it's enabled then).

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
This commit is contained in:
Michał Mirosław 2020-04-04 02:00:05 +02:00 committed by Peter Chen
parent 8b93527071
commit c2de37b31f
No known key found for this signature in database
GPG Key ID: 4859298150D671BB
1 changed files with 9 additions and 9 deletions

View File

@ -64,13 +64,14 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
priv->clk = devm_clk_get(dev, NULL); priv->clk = devm_clk_get_optional(dev, NULL);
if (!IS_ERR(priv->clk)) { if (IS_ERR(priv->clk))
ret = clk_prepare_enable(priv->clk); return PTR_ERR(priv->clk);;
if (ret) {
dev_err(dev, "failed to enable the clock: %d\n", ret); ret = clk_prepare_enable(priv->clk);
return ret; if (ret) {
} dev_err(dev, "failed to enable the clock: %d\n", ret);
return ret;
} }
ci_pdata->name = dev_name(dev); ci_pdata->name = dev_name(dev);
@ -94,8 +95,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
return 0; return 0;
clk_err: clk_err:
if (!IS_ERR(priv->clk)) clk_disable_unprepare(priv->clk);
clk_disable_unprepare(priv->clk);
return ret; return ret;
} }