aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ir-kbd-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 9c6d0ae58b1f..64360d26b32d 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -437,7 +437,10 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
437 dev_name(&client->dev)); 437 dev_name(&client->dev));
438 438
439 /* init + register input device */ 439 /* init + register input device */
440 ir_input_init(input_dev, &ir->ir, ir_type, ir->ir_codes); 440 err = ir_input_init(input_dev, &ir->ir, ir_type, ir->ir_codes);
441 if (err < 0)
442 goto err_out_free;
443
441 input_dev->id.bustype = BUS_I2C; 444 input_dev->id.bustype = BUS_I2C;
442 input_dev->name = ir->name; 445 input_dev->name = ir->name;
443 input_dev->phys = ir->phys; 446 input_dev->phys = ir->phys;
@@ -456,6 +459,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
456 return 0; 459 return 0;
457 460
458 err_out_free: 461 err_out_free:
462 ir_input_free(input_dev);
459 input_free_device(input_dev); 463 input_free_device(input_dev);
460 kfree(ir); 464 kfree(ir);
461 return err; 465 return err;
@@ -469,6 +473,7 @@ static int ir_remove(struct i2c_client *client)
469 cancel_delayed_work_sync(&ir->work); 473 cancel_delayed_work_sync(&ir->work);
470 474
471 /* unregister device */ 475 /* unregister device */
476 ir_input_free(ir->input);
472 input_unregister_device(ir->input); 477 input_unregister_device(ir->input);
473 478
474 /* free memory */ 479 /* free memory */