Skip to content

Commit

Permalink
Input: serio 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 07646e2 commit 0a66045
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions drivers/input/serio/serio.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ static int serio_match_port(const struct serio_device_id *ids, struct serio *ser

static void serio_bind_driver(struct serio *serio, struct serio_driver *drv)
{
int error;

down_write(&serio_bus.subsys.rwsem);

if (serio_match_port(drv->id_table, serio)) {
Expand All @@ -126,9 +128,19 @@ static void serio_bind_driver(struct serio *serio, struct serio_driver *drv)
serio->dev.driver = NULL;
goto out;
}
device_bind_driver(&serio->dev);
error = device_bind_driver(&serio->dev);
if (error) {
printk(KERN_WARNING
"serio: device_bind_driver() failed "
"for %s (%s) and %s, error: %d\n",
serio->phys, serio->name,
drv->description, error);
serio_disconnect_driver(serio);
serio->dev.driver = NULL;
goto out;
}
}
out:
out:
up_write(&serio_bus.subsys.rwsem);
}

Expand Down

0 comments on commit 0a66045

Please sign in to comment.