summaryrefslogtreecommitdiff
path: root/drivers/input/serio/serio.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-10-12 09:06:23 +0400
committerDmitry Torokhov <dtor@insightbb.com>2006-10-12 09:06:23 +0400
commit0a66045bcfd3a7ba5d1253f9f305b78bf636ac57 (patch)
tree3627a7bd879e2c2c4ad03c3899b15129d2900599 /drivers/input/serio/serio.c
parent07646e217f473a3e6213f8228336a9046833d6aa (diff)
downloadlinux-0a66045bcfd3a7ba5d1253f9f305b78bf636ac57.tar.xz
Input: serio core - handle errors returned by device_bind_driver()
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/serio/serio.c')
-rw-r--r--drivers/input/serio/serio.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 480fdc5d20b3..211943f85cb6 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -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)) {
@@ -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);
}