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

USB: ohci-pxa27x:Use devm_*() functions

Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 49aa57bd
...@@ -388,37 +388,28 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device ...@@ -388,37 +388,28 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
return -ENXIO; return -ENXIO;
} }
usb_clk = clk_get(&pdev->dev, NULL); usb_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(usb_clk)) if (IS_ERR(usb_clk))
return PTR_ERR(usb_clk); return PTR_ERR(usb_clk);
hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x");
if (!hcd) { if (!hcd)
retval = -ENOMEM; return -ENOMEM;
goto err0;
}
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) { if (!r) {
pr_err("no resource of IORESOURCE_MEM"); pr_err("no resource of IORESOURCE_MEM");
retval = -ENXIO; retval = -ENXIO;
goto err1; goto err;
} }
hcd->rsrc_start = r->start; hcd->rsrc_start = r->start;
hcd->rsrc_len = resource_size(r); hcd->rsrc_len = resource_size(r);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { hcd->regs = devm_ioremap_resource(&pdev->dev, r);
pr_debug("request_mem_region failed"); if (IS_ERR(hcd->regs)) {
retval = -EBUSY; retval = PTR_ERR(hcd->regs);
goto err1; goto err;
}
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
if (!hcd->regs) {
pr_debug("ioremap failed");
retval = -ENOMEM;
goto err2;
} }
/* initialize "struct pxa27x_ohci" */ /* initialize "struct pxa27x_ohci" */
...@@ -429,7 +420,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device ...@@ -429,7 +420,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
retval = pxa27x_start_hc(pxa_ohci, &pdev->dev); retval = pxa27x_start_hc(pxa_ohci, &pdev->dev);
if (retval < 0) { if (retval < 0) {
pr_debug("pxa27x_start_hc failed"); pr_debug("pxa27x_start_hc failed");
goto err3; goto err;
} }
/* Select Power Management Mode */ /* Select Power Management Mode */
...@@ -449,14 +440,8 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device ...@@ -449,14 +440,8 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
} }
pxa27x_stop_hc(pxa_ohci, &pdev->dev); pxa27x_stop_hc(pxa_ohci, &pdev->dev);
err3: err:
iounmap(hcd->regs);
err2:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err1:
usb_put_hcd(hcd); usb_put_hcd(hcd);
err0:
clk_put(usb_clk);
return retval; return retval;
} }
...@@ -480,9 +465,6 @@ void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev) ...@@ -480,9 +465,6 @@ void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev)
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
pxa27x_stop_hc(pxa_ohci, &pdev->dev); pxa27x_stop_hc(pxa_ohci, &pdev->dev);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
clk_put(pxa_ohci->clk);
usb_put_hcd(hcd); usb_put_hcd(hcd);
} }
......
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