提交 ac8d81f3 编写于 作者: J Jingoo Han 提交者: Greg Kroah-Hartman

USB: ohci-nxp: Use devm_clk_get()

Use devm_clk_get() to make cleanup paths simpler.
Signed-off-by: NJingoo Han <jg1.han@samsung.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 849da2dc
...@@ -196,17 +196,17 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) ...@@ -196,17 +196,17 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
__raw_writel(USB_SLAVE_HCLK_EN | PAD_CONTROL_LAST_DRIVEN, USB_CTRL); __raw_writel(USB_SLAVE_HCLK_EN | PAD_CONTROL_LAST_DRIVEN, USB_CTRL);
/* Enable USB PLL */ /* Enable USB PLL */
usb_pll_clk = clk_get(&pdev->dev, "ck_pll5"); usb_pll_clk = devm_clk_get(&pdev->dev, "ck_pll5");
if (IS_ERR(usb_pll_clk)) { if (IS_ERR(usb_pll_clk)) {
dev_err(&pdev->dev, "failed to acquire USB PLL\n"); dev_err(&pdev->dev, "failed to acquire USB PLL\n");
ret = PTR_ERR(usb_pll_clk); ret = PTR_ERR(usb_pll_clk);
goto fail_pll; goto fail_disable;
} }
ret = clk_enable(usb_pll_clk); ret = clk_enable(usb_pll_clk);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to start USB PLL\n"); dev_err(&pdev->dev, "failed to start USB PLL\n");
goto fail_pllen; goto fail_disable;
} }
ret = clk_set_rate(usb_pll_clk, 48000); ret = clk_set_rate(usb_pll_clk, 48000);
...@@ -216,21 +216,21 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) ...@@ -216,21 +216,21 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
} }
/* Enable USB device clock */ /* Enable USB device clock */
usb_dev_clk = clk_get(&pdev->dev, "ck_usbd"); usb_dev_clk = devm_clk_get(&pdev->dev, "ck_usbd");
if (IS_ERR(usb_dev_clk)) { if (IS_ERR(usb_dev_clk)) {
dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
ret = PTR_ERR(usb_dev_clk); ret = PTR_ERR(usb_dev_clk);
goto fail_dev; goto fail_rate;
} }
ret = clk_enable(usb_dev_clk); ret = clk_enable(usb_dev_clk);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
goto fail_deven; goto fail_rate;
} }
/* Enable USB otg clocks */ /* Enable USB otg clocks */
usb_otg_clk = clk_get(&pdev->dev, "ck_usb_otg"); usb_otg_clk = devm_clk_get(&pdev->dev, "ck_usb_otg");
if (IS_ERR(usb_otg_clk)) { if (IS_ERR(usb_otg_clk)) {
dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
ret = PTR_ERR(usb_otg_clk); ret = PTR_ERR(usb_otg_clk);
...@@ -242,7 +242,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) ...@@ -242,7 +242,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
ret = clk_enable(usb_otg_clk); ret = clk_enable(usb_otg_clk);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
goto fail_otgen; goto fail_otg;
} }
isp1301_configure(); isp1301_configure();
...@@ -284,18 +284,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) ...@@ -284,18 +284,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
usb_put_hcd(hcd); usb_put_hcd(hcd);
fail_hcd: fail_hcd:
clk_disable(usb_otg_clk); clk_disable(usb_otg_clk);
fail_otgen:
clk_put(usb_otg_clk);
fail_otg: fail_otg:
clk_disable(usb_dev_clk); clk_disable(usb_dev_clk);
fail_deven:
clk_put(usb_dev_clk);
fail_dev:
fail_rate: fail_rate:
clk_disable(usb_pll_clk); clk_disable(usb_pll_clk);
fail_pllen:
clk_put(usb_pll_clk);
fail_pll:
fail_disable: fail_disable:
isp1301_i2c_client = NULL; isp1301_i2c_client = NULL;
return ret; return ret;
...@@ -309,9 +301,7 @@ static int ohci_hcd_nxp_remove(struct platform_device *pdev) ...@@ -309,9 +301,7 @@ static int ohci_hcd_nxp_remove(struct platform_device *pdev)
ohci_nxp_stop_hc(); ohci_nxp_stop_hc();
usb_put_hcd(hcd); usb_put_hcd(hcd);
clk_disable(usb_pll_clk); clk_disable(usb_pll_clk);
clk_put(usb_pll_clk);
clk_disable(usb_dev_clk); clk_disable(usb_dev_clk);
clk_put(usb_dev_clk);
i2c_unregister_device(isp1301_i2c_client); i2c_unregister_device(isp1301_i2c_client);
isp1301_i2c_client = NULL; isp1301_i2c_client = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册