Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213624
b: refs/heads/master
c: 319feaa
h: refs/heads/master
v: v3
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 4f9dc1a commit a467317
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0cc3d4100e829d726d7c0fbf5b7b8d2146f60ba
refs/heads/master: 319feaabb6c7ccd90da6e3207563c265da7d21ae
26 changes: 15 additions & 11 deletions trunk/drivers/usb/gadget/goku_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,8 @@ static void goku_remove(struct pci_dev *pdev)
pci_resource_len (pdev, 0));
if (dev->enabled)
pci_disable_device(pdev);
device_unregister(&dev->gadget.dev);
if (dev->registered)
device_unregister(&dev->gadget.dev);

pci_set_drvdata(pdev, NULL);
dev->regs = NULL;
Expand Down Expand Up @@ -1775,15 +1776,15 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!pdev->irq) {
printk(KERN_ERR "Check PCI %s IRQ setup!\n", pci_name(pdev));
retval = -ENODEV;
goto done;
goto err;
}

/* alloc, and start init */
dev = kzalloc (sizeof *dev, GFP_KERNEL);
if (dev == NULL){
pr_debug("enomem %s\n", pci_name(pdev));
retval = -ENOMEM;
goto done;
goto err;
}

spin_lock_init(&dev->lock);
Expand All @@ -1801,7 +1802,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
retval = pci_enable_device(pdev);
if (retval < 0) {
DBG(dev, "can't enable, %d\n", retval);
goto done;
goto err;
}
dev->enabled = 1;

Expand All @@ -1810,15 +1811,15 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!request_mem_region(resource, len, driver_name)) {
DBG(dev, "controller already in use\n");
retval = -EBUSY;
goto done;
goto err;
}
dev->got_region = 1;

base = ioremap_nocache(resource, len);
if (base == NULL) {
DBG(dev, "can't map memory\n");
retval = -EFAULT;
goto done;
goto err;
}
dev->regs = (struct goku_udc_regs __iomem *) base;

Expand All @@ -1834,7 +1835,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
driver_name, dev) != 0) {
DBG(dev, "request interrupt %d failed\n", pdev->irq);
retval = -EBUSY;
goto done;
goto err;
}
dev->got_irq = 1;
if (use_dma)
Expand All @@ -1845,13 +1846,16 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
create_proc_read_entry(proc_node_name, 0, NULL, udc_proc_read, dev);
#endif

/* done */
the_controller = dev;
retval = device_register(&dev->gadget.dev);
if (retval == 0)
return 0;
if (retval) {
put_device(&dev->gadget.dev);
goto err;
}
dev->registered = 1;
return 0;

done:
err:
if (dev)
goku_remove (pdev);
return retval;
Expand Down

0 comments on commit a467317

Please sign in to comment.