aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-10-12 01:06:34 -0400
committerDmitry Torokhov <dtor@insightbb.com>2006-10-12 01:06:34 -0400
commit23de1510e2468ea349354889097e018d4e8770c5 (patch)
tree47e5726ec64119d967ef03fb1ddcf2ae486a7585
parent0a66045bcfd3a7ba5d1253f9f305b78bf636ac57 (diff)
Input: gameport core - handle errors returned by device_bind_driver()
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/gameport/gameport.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 3f47ae55c6f..a0af97efe6a 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);
}