summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/saa7115.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-05-02 13:29:43 +0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-05-21 12:52:15 +0200
commitc02b211df6fc54e51ee554c27a6736a11255a764 (patch)
treea2b78b3a7a0400550fdd89da110d1b21a9e1acb1 /drivers/media/i2c/saa7115.c
parent[media] media: i2c: Convert to gpio_request_one() (diff)
downloadlinux-c02b211df6fc54e51ee554c27a6736a11255a764.tar.xz
linux-c02b211df6fc54e51ee554c27a6736a11255a764.zip
[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/saa7115.c')
-rw-r--r--drivers/media/i2c/saa7115.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 52c717d977c9..eecb92df5d96 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1614,7 +1614,7 @@ static int saa711x_probe(struct i2c_client *client,
v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name,
client->addr << 1, client->adapter->name);
- state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
+ state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
if (state == NULL)
return -ENOMEM;
sd = &state->sd;
@@ -1640,7 +1640,6 @@ static int saa711x_probe(struct i2c_client *client,
int err = hdl->error;
v4l2_ctrl_handler_free(hdl);
- kfree(state);
return err;
}
v4l2_ctrl_auto_cluster(2, &state->agc, 0, true);
@@ -1712,7 +1711,6 @@ static int saa711x_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
- kfree(to_state(sd));
return 0;
}