mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-15 21:30:43 +00:00
USB: ohci-jz4740: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f1080e4d90
commit
c81c3b0115
@ -174,31 +174,23 @@ static int jz4740_ohci_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
jz4740_ohci = hcd_to_jz4740_hcd(hcd);
|
jz4740_ohci = hcd_to_jz4740_hcd(hcd);
|
||||||
|
|
||||||
res = request_mem_region(res->start, resource_size(res), hcd_name);
|
hcd->rsrc_start = res->start;
|
||||||
if (!res) {
|
hcd->rsrc_len = resource_size(res);
|
||||||
dev_err(&pdev->dev, "Failed to request mem region.\n");
|
|
||||||
ret = -EBUSY;
|
hcd->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
if (IS_ERR(hcd->regs)) {
|
||||||
|
ret = PTR_ERR(hcd->regs);
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcd->rsrc_start = res->start;
|
jz4740_ohci->clk = devm_clk_get(&pdev->dev, "uhc");
|
||||||
hcd->rsrc_len = resource_size(res);
|
|
||||||
hcd->regs = ioremap(res->start, resource_size(res));
|
|
||||||
|
|
||||||
if (!hcd->regs) {
|
|
||||||
dev_err(&pdev->dev, "Failed to ioremap registers.\n");
|
|
||||||
ret = -EBUSY;
|
|
||||||
goto err_release_mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
jz4740_ohci->clk = clk_get(&pdev->dev, "uhc");
|
|
||||||
if (IS_ERR(jz4740_ohci->clk)) {
|
if (IS_ERR(jz4740_ohci->clk)) {
|
||||||
ret = PTR_ERR(jz4740_ohci->clk);
|
ret = PTR_ERR(jz4740_ohci->clk);
|
||||||
dev_err(&pdev->dev, "Failed to get clock: %d\n", ret);
|
dev_err(&pdev->dev, "Failed to get clock: %d\n", ret);
|
||||||
goto err_iounmap;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
jz4740_ohci->vbus = regulator_get(&pdev->dev, "vbus");
|
jz4740_ohci->vbus = devm_regulator_get(&pdev->dev, "vbus");
|
||||||
if (IS_ERR(jz4740_ohci->vbus))
|
if (IS_ERR(jz4740_ohci->vbus))
|
||||||
jz4740_ohci->vbus = NULL;
|
jz4740_ohci->vbus = NULL;
|
||||||
|
|
||||||
@ -222,17 +214,10 @@ static int jz4740_ohci_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_disable:
|
err_disable:
|
||||||
if (jz4740_ohci->vbus) {
|
if (jz4740_ohci->vbus)
|
||||||
regulator_disable(jz4740_ohci->vbus);
|
regulator_disable(jz4740_ohci->vbus);
|
||||||
regulator_put(jz4740_ohci->vbus);
|
|
||||||
}
|
|
||||||
clk_disable(jz4740_ohci->clk);
|
clk_disable(jz4740_ohci->clk);
|
||||||
|
|
||||||
clk_put(jz4740_ohci->clk);
|
|
||||||
err_iounmap:
|
|
||||||
iounmap(hcd->regs);
|
|
||||||
err_release_mem:
|
|
||||||
release_mem_region(res->start, resource_size(res));
|
|
||||||
err_free:
|
err_free:
|
||||||
usb_put_hcd(hcd);
|
usb_put_hcd(hcd);
|
||||||
|
|
||||||
@ -246,16 +231,10 @@ static int jz4740_ohci_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
usb_remove_hcd(hcd);
|
usb_remove_hcd(hcd);
|
||||||
|
|
||||||
if (jz4740_ohci->vbus) {
|
if (jz4740_ohci->vbus)
|
||||||
regulator_disable(jz4740_ohci->vbus);
|
regulator_disable(jz4740_ohci->vbus);
|
||||||
regulator_put(jz4740_ohci->vbus);
|
|
||||||
}
|
|
||||||
|
|
||||||
clk_disable(jz4740_ohci->clk);
|
clk_disable(jz4740_ohci->clk);
|
||||||
clk_put(jz4740_ohci->clk);
|
|
||||||
|
|
||||||
iounmap(hcd->regs);
|
|
||||||
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
|
|
||||||
|
|
||||||
usb_put_hcd(hcd);
|
usb_put_hcd(hcd);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user