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;
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;
}
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);
}
chip_addr = ioremap_nocache(pci_mem_phy0,memlength);
if (!chip_addr) {
printk(KERN_ERR "Error ioremap failed\n");
+ release_mem_region(pci_mem_phy0, memlength);
ret_status = -ENOMEM;
- goto cleanup3;
+ goto cleanup2;
}
/* bad pci latencies can contribute to overruns */
}
iounmap(chip_addr);
+ release_mem_region(pci_mem_phy0, memlength);
/* Host Controller presence is detected by writing to scratch register
* and reading back and checking the contents are same or not
if (reg_data != 0xFACE) {
dev_err(&dev->dev, "scratch register mismatch %x\n", reg_data);
ret_status = -ENOMEM;
- goto cleanup3;
+ goto cleanup2;
}
pci_set_master(dev);
reg_data |= 0x900;
writel(reg_data, iobase + PLX_INT_CSR_REG);
- dev->dev.dma_mask = NULL;
- ret_status = isp1760_register(&dev->resource[3], dev->irq, IRQF_SHARED,
- &dev->dev, devflags);
- if (ret_status < 0)
- goto cleanup3;
-
/* done with PLX IO access */
iounmap(iobase);
release_mem_region(nxp_pci_io_base, iolength);
- return 0;
+ dev->dev.dma_mask = NULL;
+ return isp1760_register(&dev->resource[3], dev->irq, IRQF_SHARED,
+ &dev->dev, devflags);
-cleanup3:
- release_mem_region(pci_mem_phy0, memlength);
cleanup2:
iounmap(iobase);
cleanup1:
unsigned int devflags = 0;
struct resource *mem_res;
struct resource *irq_res;
- resource_size_t mem_size;
int ret;
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem_res) {
- pr_warning("isp1760: Memory resource not available\n");
- return -ENODEV;
- }
- mem_size = resource_size(mem_res);
- if (!request_mem_region(mem_res->start, mem_size, "isp1760")) {
- pr_warning("isp1760: Cannot reserve the memory resource\n");
- return -EBUSY;
- }
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq_res) {
pr_warning("isp1760: IRQ resource not available\n");
- ret = -ENODEV;
- goto cleanup;
+ return -ENODEV;
}
irqflags |= irq_res->flags & IRQF_TRIGGER_MASK;
ret = isp1760_register(mem_res, irq_res->start, irqflags, &pdev->dev,
devflags);
if (ret < 0)
- goto cleanup;
+ return ret;
pr_info("ISP1760 USB device initialised\n");
return 0;
-
-cleanup:
- release_mem_region(mem_res->start, mem_size);
- return ret;
}
static int isp1760_plat_remove(struct platform_device *pdev)