summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/vrc4173_cardu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-21 14:25:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-21 14:25:16 -0700
commitb65378898c2eefb20f419632c1199bc0592e2f79 (patch)
tree052bb72d329c44790f91fc8097b8500d4774d02c /drivers/pcmcia/vrc4173_cardu.c
parent157b6ceb13e4b4148ee03dd517dbe88748943125 (diff)
parent5b917a1420d3d1a9c8da49fb0090692dc9aaee86 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (22 commits) pcmcia: synclink_cs: fix information leak to userland pcmcia: don't call flush_scheduled_work() spuriously serial_cs: drop spurious flush_scheduled_work() call pcmcia/yenta: guide users in case of problems with O2-bridges pcmcia: fix unused function compile warning pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device pcmcia: add a few debug statements pcmcia: remove obsolete and wrong comments pcmcia: avoid messages on module (un)loading pcmcia: move driver name to struct pcmcia_driver pcmcia: remove the "Finally, report what we've done" message pcmcia: use autoconfiguration feature for ioports and iomem pcmcia: introduce autoconfiguration feature pcmcia: Documentation update pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device pcmcia: move config_{base,index,regs} to struct pcmcia_device pcmcia: simplify IntType pcmcia: simplify Status, ExtStatus register access pcmcia: remove Pin, Copy configuration register access pcmcia: move Vpp setup to struct pcmcia_device ...
Diffstat (limited to 'drivers/pcmcia/vrc4173_cardu.c')
-rw-r--r--drivers/pcmcia/vrc4173_cardu.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c
index 9b3c15827e5..c6d36b3a6ce 100644
--- a/drivers/pcmcia/vrc4173_cardu.c
+++ b/drivers/pcmcia/vrc4173_cardu.c
@@ -461,7 +461,7 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev,
{
vrc4173_socket_t *socket;
unsigned long start, len, flags;
- int slot, err;
+ int slot, err, ret;
slot = vrc4173_cardu_slots++;
socket = &cardu_sockets[slot];
@@ -474,43 +474,63 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev,
return err;
start = pci_resource_start(dev, 0);
- if (start == 0)
- return -ENODEV;
+ if (start == 0) {
+ ret = -ENODEV;
+ goto disable;
+ }
len = pci_resource_len(dev, 0);
- if (len == 0)
- return -ENODEV;
+ if (len == 0) {
+ ret = -ENODEV;
+ goto disable;
+ }
- if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0)
- return -EBUSY;
+ flags = pci_resource_flags(dev, 0);
+ if ((flags & IORESOURCE_MEM) == 0) {
+ ret = -EBUSY;
+ goto disable;
+ }
- if ((err = pci_request_regions(dev, socket->name)) < 0)
- return err;
+ err = pci_request_regions(dev, socket->name);
+ if (err < 0) {
+ ret = err;
+ goto disable;
+ }
socket->base = ioremap(start, len);
- if (socket->base == NULL)
- return -ENODEV;
+ if (socket->base == NULL) {
+ ret = -ENODEV;
+ goto release;
+ }
socket->dev = dev;
socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1);
if (socket->pcmcia_socket == NULL) {
- iounmap(socket->base);
- socket->base = NULL;
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto unmap;
}
if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) {
- pcmcia_unregister_socket(socket->pcmcia_socket);
- socket->pcmcia_socket = NULL;
- iounmap(socket->base);
- socket->base = NULL;
- return -EBUSY;
+ ret = -EBUSY;
+ goto unregister;
}
printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq);
return 0;
+
+unregister:
+ pcmcia_unregister_socket(socket->pcmcia_socket);
+ socket->pcmcia_socket = NULL;
+unmap:
+ iounmap(socket->base);
+ socket->base = NULL;
+release:
+ pci_release_regions(dev);
+disable:
+ pci_disable_device(dev);
+ return ret;
}
static int __devinit vrc4173_cardu_setup(char *options)