aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/gameport/fm801-gp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 08:56:43 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 08:56:43 -0700
commit43f82216f0bd114599f4a221ae6924f3658a0c9a (patch)
tree89dbd85a0a1882ae38e6b61e360b365c018195fd /drivers/input/gameport/fm801-gp.c
parent20f85957667ccc53183b5ffac22213d75e317408 (diff)
parentb435fdcda126db42343b8055d04a0a27c229717b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: fm801-gp - handle errors from pci_enable_device() Input: gameport core - handle errors returned by device_bind_driver() Input: serio core - handle errors returned by device_bind_driver() Lockdep: fix compile error in drivers/input/serio/serio.c Input: serio - add lockdep annotations Lockdep: add lockdep_set_class_and_subclass() and lockdep_set_subclass() Input: atkbd - supress "too many keys" error message Input: i8042 - supress ACK/NAKs when blinking during panic Input: add missing exports to fix modular build
Diffstat (limited to 'drivers/input/gameport/fm801-gp.c')
-rw-r--r--drivers/input/gameport/fm801-gp.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c
index 90de5afe03c..1dec00e20db 100644
--- a/drivers/input/gameport/fm801-gp.c
+++ b/drivers/input/gameport/fm801-gp.c
@@ -82,17 +82,19 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
{
struct fm801_gp *gp;
struct gameport *port;
+ int error;
gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL);
port = gameport_allocate_port();
if (!gp || !port) {
printk(KERN_ERR "fm801-gp: Memory allocation failed\n");
- kfree(gp);
- gameport_free_port(port);
- return -ENOMEM;
+ error = -ENOMEM;
+ goto err_out_free;
}
- pci_enable_device(pci);
+ error = pci_enable_device(pci);
+ if (error)
+ goto err_out_free;
port->open = fm801_gp_open;
#ifdef HAVE_COOKED
@@ -108,9 +110,8 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
if (!gp->res_port) {
printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n",
port->io, port->io + 0x0f);
- gameport_free_port(port);
- kfree(gp);
- return -EBUSY;
+ error = -EBUSY;
+ goto err_out_disable_dev;
}
pci_set_drvdata(pci, gp);
@@ -119,6 +120,13 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
gameport_register_port(port);
return 0;
+
+ err_out_disable_dev:
+ pci_disable_device(pci);
+ err_out_free:
+ gameport_free_port(port);
+ kfree(gp);
+ return error;
}
static void __devexit fm801_gp_remove(struct pci_dev *pci)