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

USB: ehci-w90x900: Use devm_ioremap_resource()

Use devm_ioremap_resource() to make cleanup paths simpler.
Signed-off-by: NJingoo Han <jg1.han@samsung.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 644db166
...@@ -58,17 +58,12 @@ static int usb_w90x900_probe(const struct hc_driver *driver, ...@@ -58,17 +58,12 @@ static int usb_w90x900_probe(const struct hc_driver *driver,
hcd->rsrc_start = res->start; hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res); hcd->rsrc_len = resource_size(res);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { hcd->regs = devm_ioremap_resource(&pdev->dev, res);
retval = -EBUSY; if (IS_ERR(hcd->regs)) {
retval = PTR_ERR(hcd->regs);
goto err2; goto err2;
} }
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
if (hcd->regs == NULL) {
retval = -EFAULT;
goto err3;
}
ehci = hcd_to_ehci(hcd); ehci = hcd_to_ehci(hcd);
ehci->caps = hcd->regs; ehci->caps = hcd->regs;
ehci->regs = hcd->regs + ehci->regs = hcd->regs +
...@@ -88,18 +83,14 @@ static int usb_w90x900_probe(const struct hc_driver *driver, ...@@ -88,18 +83,14 @@ static int usb_w90x900_probe(const struct hc_driver *driver,
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0)
goto err4; goto err2;
retval = usb_add_hcd(hcd, irq, IRQF_SHARED); retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (retval != 0) if (retval != 0)
goto err4; goto err2;
device_wakeup_enable(hcd->self.controller); device_wakeup_enable(hcd->self.controller);
return retval; return retval;
err4:
iounmap(hcd->regs);
err3:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err2: err2:
usb_put_hcd(hcd); usb_put_hcd(hcd);
err1: err1:
...@@ -110,8 +101,6 @@ static void usb_w90x900_remove(struct usb_hcd *hcd, ...@@ -110,8 +101,6 @@ static void usb_w90x900_remove(struct usb_hcd *hcd,
struct platform_device *pdev) struct platform_device *pdev)
{ {
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd); usb_put_hcd(hcd);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册