Skip to content

Commit

Permalink
Input: gameport core - handle errors returned by device_bind_driver()
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Oct 12, 2006
1 parent 0a66045 commit 23de151
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions drivers/input/gameport/gameport.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,29 @@ 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;
if (drv->connect(gameport, drv)) {
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);
}

Expand Down

0 comments on commit 23de151

Please sign in to comment.