diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/joystick/tmdc.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c index 60e2aac7d06e..bb23ed2a04a6 100644 --- a/drivers/input/joystick/tmdc.c +++ b/drivers/input/joystick/tmdc.c | |||
@@ -284,13 +284,13 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data) | |||
284 | struct tmdc_port *port; | 284 | struct tmdc_port *port; |
285 | struct input_dev *input_dev; | 285 | struct input_dev *input_dev; |
286 | int i, j, b = 0; | 286 | int i, j, b = 0; |
287 | int err; | ||
287 | 288 | ||
288 | tmdc->port[idx] = port = kzalloc(sizeof (struct tmdc_port), GFP_KERNEL); | 289 | tmdc->port[idx] = port = kzalloc(sizeof (struct tmdc_port), GFP_KERNEL); |
289 | input_dev = input_allocate_device(); | 290 | input_dev = input_allocate_device(); |
290 | if (!port || !input_dev) { | 291 | if (!port || !input_dev) { |
291 | kfree(port); | 292 | err = -ENOMEM; |
292 | input_free_device(input_dev); | 293 | goto fail; |
293 | return -ENOMEM; | ||
294 | } | 294 | } |
295 | 295 | ||
296 | port->mode = data[TMDC_BYTE_ID]; | 296 | port->mode = data[TMDC_BYTE_ID]; |
@@ -347,9 +347,15 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data) | |||
347 | b += port->btnc[i]; | 347 | b += port->btnc[i]; |
348 | } | 348 | } |
349 | 349 | ||
350 | input_register_device(port->dev); | 350 | err = input_register_device(port->dev); |
351 | if (err) | ||
352 | goto fail; | ||
351 | 353 | ||
352 | return 0; | 354 | return 0; |
355 | |||
356 | fail: input_free_device(input_dev); | ||
357 | kfree(port); | ||
358 | return err; | ||
353 | } | 359 | } |
354 | 360 | ||
355 | /* | 361 | /* |
@@ -424,6 +430,7 @@ static void tmdc_disconnect(struct gameport *gameport) | |||
424 | static struct gameport_driver tmdc_drv = { | 430 | static struct gameport_driver tmdc_drv = { |
425 | .driver = { | 431 | .driver = { |
426 | .name = "tmdc", | 432 | .name = "tmdc", |
433 | .owner = THIS_MODULE, | ||
427 | }, | 434 | }, |
428 | .description = DRIVER_DESC, | 435 | .description = DRIVER_DESC, |
429 | .connect = tmdc_connect, | 436 | .connect = tmdc_connect, |