aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/cobra.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/cobra.c
parent52c1f5704d7555a16641429b2e7af5d26d7b119a (diff)
Input: joysticks - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick/cobra.c')
-rw-r--r--drivers/input/joystick/cobra.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c
index d5e42eb88a20..034ec39c251d 100644
--- a/drivers/input/joystick/cobra.c
+++ b/drivers/input/joystick/cobra.c
@@ -223,12 +223,15 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
223 for (j = 0; cobra_btn[j]; j++) 223 for (j = 0; cobra_btn[j]; j++)
224 set_bit(cobra_btn[j], input_dev->keybit); 224 set_bit(cobra_btn[j], input_dev->keybit);
225 225
226 input_register_device(cobra->dev[i]); 226 err = input_register_device(cobra->dev[i]);
227 if (err)
228 goto fail4;
227 } 229 }
228 230
229 return 0; 231 return 0;
230 232
231 fail3: for (i = 0; i < 2; i++) 233 fail4: input_free_device(cobra->dev[i]);
234 fail3: while (--i >= 0)
232 if (cobra->dev[i]) 235 if (cobra->dev[i])
233 input_unregister_device(cobra->dev[i]); 236 input_unregister_device(cobra->dev[i]);
234 fail2: gameport_close(gameport); 237 fail2: gameport_close(gameport);