[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:

committed by
Mauro Carvalho Chehab

父節點
95323361e5
當前提交
c02b211df6
@@ -417,7 +417,7 @@ static int adp1653_probe(struct i2c_client *client,
|
||||
if (client->dev.platform_data == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
flash = kzalloc(sizeof(*flash), GFP_KERNEL);
|
||||
flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL);
|
||||
if (flash == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -443,7 +443,6 @@ static int adp1653_probe(struct i2c_client *client,
|
||||
|
||||
free_and_quit:
|
||||
v4l2_ctrl_handler_free(&flash->ctrls);
|
||||
kfree(flash);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -455,7 +454,7 @@ static int adp1653_remove(struct i2c_client *client)
|
||||
v4l2_device_unregister_subdev(&flash->subdev);
|
||||
v4l2_ctrl_handler_free(&flash->ctrls);
|
||||
media_entity_cleanup(&flash->subdev.entity);
|
||||
kfree(flash);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user