Commit 49aa57bd authored by Jingoo Han's avatar Jingoo Han Committed by Greg Kroah-Hartman

USB: ehci-octeon: Use devm_ioremap_resource()

Use devm_ioremap_resource() to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Acked-by: default avatarDavid Daney <david.daney@cavium.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7667fe69
...@@ -128,20 +128,12 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) ...@@ -128,20 +128,12 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
hcd->rsrc_start = res_mem->start; hcd->rsrc_start = res_mem->start;
hcd->rsrc_len = resource_size(res_mem); hcd->rsrc_len = resource_size(res_mem);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd->regs = devm_ioremap_resource(&pdev->dev, res_mem);
OCTEON_EHCI_HCD_NAME)) { if (IS_ERR(hcd->regs)) {
dev_err(&pdev->dev, "request_mem_region failed\n"); ret = PTR_ERR(hcd->regs);
ret = -EBUSY;
goto err1; goto err1;
} }
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
if (!hcd->regs) {
dev_err(&pdev->dev, "ioremap failed\n");
ret = -ENOMEM;
goto err2;
}
ehci_octeon_start(); ehci_octeon_start();
ehci = hcd_to_ehci(hcd); ehci = hcd_to_ehci(hcd);
...@@ -156,19 +148,16 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) ...@@ -156,19 +148,16 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
ret = usb_add_hcd(hcd, irq, IRQF_SHARED); ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (ret) { if (ret) {
dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret);
goto err3; goto err2;
} }
device_wakeup_enable(hcd->self.controller); device_wakeup_enable(hcd->self.controller);
platform_set_drvdata(pdev, hcd); platform_set_drvdata(pdev, hcd);
return 0; return 0;
err3: err2:
ehci_octeon_stop(); ehci_octeon_stop();
iounmap(hcd->regs);
err2:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err1: err1:
usb_put_hcd(hcd); usb_put_hcd(hcd);
return ret; return ret;
...@@ -181,8 +170,6 @@ static int ehci_octeon_drv_remove(struct platform_device *pdev) ...@@ -181,8 +170,6 @@ static int ehci_octeon_drv_remove(struct platform_device *pdev)
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
ehci_octeon_stop(); ehci_octeon_stop();
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd); usb_put_hcd(hcd);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment