USB: ehci-fsl: Use devm_ioremap_resource()
Use devm_ioremap_resource() 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:
Родитель
806f6e6b92
Коммит
7667fe69e7
|
@ -102,19 +102,11 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
|||
}
|
||||
hcd->rsrc_start = res->start;
|
||||
hcd->rsrc_len = resource_size(res);
|
||||
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
|
||||
driver->description)) {
|
||||
dev_dbg(&pdev->dev, "controller already in use\n");
|
||||
retval = -EBUSY;
|
||||
hcd->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(hcd->regs)) {
|
||||
retval = PTR_ERR(hcd->regs);
|
||||
goto err2;
|
||||
}
|
||||
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
|
||||
|
||||
if (hcd->regs == NULL) {
|
||||
dev_dbg(&pdev->dev, "error mapping memory\n");
|
||||
retval = -EFAULT;
|
||||
goto err3;
|
||||
}
|
||||
|
||||
pdata->regs = hcd->regs;
|
||||
|
||||
|
@ -126,7 +118,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
|||
*/
|
||||
if (pdata->init && pdata->init(pdev)) {
|
||||
retval = -ENODEV;
|
||||
goto err4;
|
||||
goto err2;
|
||||
}
|
||||
|
||||
/* Enable USB controller, 83xx or 8536 */
|
||||
|
@ -137,7 +129,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
|||
|
||||
retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
|
||||
if (retval != 0)
|
||||
goto err4;
|
||||
goto err2;
|
||||
device_wakeup_enable(hcd->self.controller);
|
||||
|
||||
#ifdef CONFIG_USB_OTG
|
||||
|
@ -153,21 +145,17 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
|||
&ehci_to_hcd(ehci)->self);
|
||||
if (retval) {
|
||||
usb_put_phy(hcd->phy);
|
||||
goto err4;
|
||||
goto err2;
|
||||
}
|
||||
} else {
|
||||
dev_err(&pdev->dev, "can't find phy\n");
|
||||
retval = -ENODEV;
|
||||
goto err4;
|
||||
goto err2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return retval;
|
||||
|
||||
err4:
|
||||
iounmap(hcd->regs);
|
||||
err3:
|
||||
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
|
||||
err2:
|
||||
usb_put_hcd(hcd);
|
||||
err1:
|
||||
|
@ -206,8 +194,6 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
|
|||
*/
|
||||
if (pdata->exit)
|
||||
pdata->exit(pdev);
|
||||
iounmap(hcd->regs);
|
||||
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
|
||||
usb_put_hcd(hcd);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче