diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-01-21 00:55:52 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-01-27 09:38:54 -0600 |
commit | 10feee144664a87a07f75756f1ee577ce17616c4 (patch) | |
tree | 1cdef2789f50ce8136f5b20a1cd9c0a0682d3aee /drivers/usb/host/isp1760-hcd.c | |
parent | 4942e00e5582dcb45d432c35d47980ced72cdb8e (diff) |
usb: isp1760: Use the managed devm_ioremap_resource() API
This simplifies error and remove code paths.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/host/isp1760-hcd.c')
-rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index e99dafa6cacd..2e38efe8d4d4 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c @@ -2234,14 +2234,14 @@ int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, priv->rst_gpio = devm_gpiod_get_optional(dev, NULL, GPIOD_OUT_HIGH); if (IS_ERR(priv->rst_gpio)) { ret = PTR_ERR(priv->rst_gpio); - goto err_put; + goto error; } init_memory(priv); - hcd->regs = ioremap(mem->start, resource_size(mem)); - if (!hcd->regs) { - ret = -EIO; - goto err_put; + hcd->regs = devm_ioremap_resource(dev, mem); + if (IS_ERR(hcd->regs)) { + ret = PTR_ERR(hcd->regs); + goto error; } hcd->irq = irq; @@ -2250,19 +2250,15 @@ int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, ret = usb_add_hcd(hcd, irq, irqflags); if (ret) - goto err_unmap; + goto error; device_wakeup_enable(hcd->self.controller); dev_set_drvdata(dev, hcd); return 0; -err_unmap: - iounmap(hcd->regs); - -err_put: +error: usb_put_hcd(hcd); - return ret; } @@ -2271,8 +2267,6 @@ void isp1760_unregister(struct device *dev) struct usb_hcd *hcd = dev_get_drvdata(dev); usb_remove_hcd(hcd); - iounmap(hcd->regs); - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); } |