summaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/grip_mp.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:09 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:09 -0500
commit127278ce2254c61f1346500374d61e33f74a8729 (patch)
treef7460f3f452d3dbe2d7a52dfa23a51dee0d312f3 /drivers/input/joystick/grip_mp.c
parent52c1f5704d7555a16641429b2e7af5d26d7b119a (diff)
downloadtalos-obmc-linux-127278ce2254c61f1346500374d61e33f74a8729.tar.gz
talos-obmc-linux-127278ce2254c61f1346500374d61e33f74a8729.zip
Input: joysticks - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick/grip_mp.c')
-rw-r--r--drivers/input/joystick/grip_mp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c
index 62438944a69a..8120a9c40773 100644
--- a/drivers/input/joystick/grip_mp.c
+++ b/drivers/input/joystick/grip_mp.c
@@ -423,7 +423,10 @@ static int get_and_decode_packet(struct grip_mp *grip, int flags)
if (!port->registered) {
dbg("New Grip pad in multiport slot %d.\n", slot);
- register_slot(slot, grip);
+ if (register_slot(slot, grip)) {
+ port->mode = GRIP_MODE_RESET;
+ port->dirty = 0;
+ }
}
return flags;
}
@@ -585,6 +588,7 @@ static int register_slot(int slot, struct grip_mp *grip)
struct grip_port *port = grip->port[slot];
struct input_dev *input_dev;
int j, t;
+ int err;
port->dev = input_dev = input_allocate_device();
if (!input_dev)
@@ -610,7 +614,12 @@ static int register_slot(int slot, struct grip_mp *grip)
if (t > 0)
set_bit(t, input_dev->keybit);
- input_register_device(port->dev);
+ err = input_register_device(port->dev);
+ if (err) {
+ input_free_device(port->dev);
+ return err;
+ }
+
port->registered = 1;
if (port->dirty) /* report initial state, if any */
OpenPOWER on IntegriCloud