diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-05-02 07:29:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-05-21 06:52:15 -0400 |
commit | c02b211df6fc54e51ee554c27a6736a11255a764 (patch) | |
tree | a2b78b3a7a0400550fdd89da110d1b21a9e1acb1 /drivers/media/i2c/bt819.c | |
parent | 95323361e5313733a54771c5059f5b352adbf32c (diff) |
[media] media: i2c: Convert to devm_kzalloc()
Using the managed function the kfree() calls can be removed from the
probe error path and the remove handler.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/bt819.c')
-rw-r--r-- | drivers/media/i2c/bt819.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/i2c/bt819.c b/drivers/media/i2c/bt819.c index 377bf05b1efd..ee9ed67e7910 100644 --- a/drivers/media/i2c/bt819.c +++ b/drivers/media/i2c/bt819.c | |||
@@ -425,7 +425,7 @@ static int bt819_probe(struct i2c_client *client, | |||
425 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 425 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
426 | return -ENODEV; | 426 | return -ENODEV; |
427 | 427 | ||
428 | decoder = kzalloc(sizeof(struct bt819), GFP_KERNEL); | 428 | decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); |
429 | if (decoder == NULL) | 429 | if (decoder == NULL) |
430 | return -ENOMEM; | 430 | return -ENOMEM; |
431 | sd = &decoder->sd; | 431 | sd = &decoder->sd; |
@@ -476,7 +476,6 @@ static int bt819_probe(struct i2c_client *client, | |||
476 | int err = decoder->hdl.error; | 476 | int err = decoder->hdl.error; |
477 | 477 | ||
478 | v4l2_ctrl_handler_free(&decoder->hdl); | 478 | v4l2_ctrl_handler_free(&decoder->hdl); |
479 | kfree(decoder); | ||
480 | return err; | 479 | return err; |
481 | } | 480 | } |
482 | v4l2_ctrl_handler_setup(&decoder->hdl); | 481 | v4l2_ctrl_handler_setup(&decoder->hdl); |
@@ -490,7 +489,6 @@ static int bt819_remove(struct i2c_client *client) | |||
490 | 489 | ||
491 | v4l2_device_unregister_subdev(sd); | 490 | v4l2_device_unregister_subdev(sd); |
492 | v4l2_ctrl_handler_free(&decoder->hdl); | 491 | v4l2_ctrl_handler_free(&decoder->hdl); |
493 | kfree(decoder); | ||
494 | return 0; | 492 | return 0; |
495 | } | 493 | } |
496 | 494 | ||