[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>
This commit is contained in:
Laurent Pinchart
2013-05-02 08:29:43 -03:00
committed by Mauro Carvalho Chehab
parent 95323361e5
commit c02b211df6
56 changed files with 79 additions and 202 deletions

View File

@@ -730,7 +730,7 @@ static int mt9m032_probe(struct i2c_client *client,
if (!client->dev.platform_data)
return -ENODEV;
sensor = kzalloc(sizeof(*sensor), GFP_KERNEL);
sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL);
if (sensor == NULL)
return -ENOMEM;
@@ -860,7 +860,6 @@ error_ctrl:
v4l2_ctrl_handler_free(&sensor->ctrls);
error_sensor:
mutex_destroy(&sensor->lock);
kfree(sensor);
return ret;
}
@@ -873,7 +872,6 @@ static int mt9m032_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(&sensor->ctrls);
media_entity_cleanup(&subdev->entity);
mutex_destroy(&sensor->lock);
kfree(sensor);
return 0;
}