aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/gameport
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
parentMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc (diff)
parentInput: fm801-gp - handle errors from pci_enable_device() (diff)
downloadlinux-dev-43f82216f0bd114599f4a221ae6924f3658a0c9a.tar.xz
linux-dev-43f82216f0bd114599f4a221ae6924f3658a0c9a.zip
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')
-rw-r--r--drivers/input/gameport/fm801-gp.c22
-rw-r--r--drivers/input/gameport/gameport.c18
2 files changed, 31 insertions, 9 deletions
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c
index 90de5afe03c2..1dec00e20dbc 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)
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 3f47ae55c6f3..a0af97efe6ac 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -191,6 +191,8 @@ static void gameport_run_poll_handler(unsigned long d)
static void gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv)
{
+ int error;
+
down_write(&gameport_bus.subsys.rwsem);
gameport->dev.driver = &drv->driver;
@@ -198,8 +200,20 @@ static void gameport_bind_driver(struct gameport *gameport, struct gameport_driv
gameport->dev.driver = NULL;
goto out;
}
- device_bind_driver(&gameport->dev);
-out:
+
+ error = device_bind_driver(&gameport->dev);
+ if (error) {
+ printk(KERN_WARNING
+ "gameport: device_bind_driver() failed "
+ "for %s (%s) and %s, error: %d\n",
+ gameport->phys, gameport->name,
+ drv->description, error);
+ drv->disconnect(gameport);
+ gameport->dev.driver = NULL;
+ goto out;
+ }
+
+ out:
up_write(&gameport_bus.subsys.rwsem);
}