summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/mt9v032.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-05-02 13:34:30 +0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-05-21 12:49:54 +0200
commit9462550f66dfbbb2eb0961af2c9d2c3e000d9239 (patch)
treed338df7b7ab020722c7c19cc24c57ed7153b0029 /drivers/media/i2c/mt9v032.c
parent[media] mt9p031: Use gpio_is_valid() (diff)
downloadlinux-9462550f66dfbbb2eb0961af2c9d2c3e000d9239.tar.xz
linux-9462550f66dfbbb2eb0961af2c9d2c3e000d9239.zip
[media] mt9v032: Free control handler in cleanup paths
The control handler must be freed in the probe error path and in the remove handler. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/mt9v032.c')
-rw-r--r--drivers/media/i2c/mt9v032.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 3f356cb28256..24ea6fd3ee81 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -830,8 +830,11 @@ static int mt9v032_probe(struct i2c_client *client,
mt9v032->pad.flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_init(&mt9v032->subdev.entity, 1, &mt9v032->pad, 0);
- if (ret < 0)
+
+ if (ret < 0) {
+ v4l2_ctrl_handler_free(&mt9v032->ctrls);
kfree(mt9v032);
+ }
return ret;
}
@@ -841,9 +844,11 @@ static int mt9v032_remove(struct i2c_client *client)
struct v4l2_subdev *subdev = i2c_get_clientdata(client);
struct mt9v032 *mt9v032 = to_mt9v032(subdev);
+ v4l2_ctrl_handler_free(&mt9v032->ctrls);
v4l2_device_unregister_subdev(subdev);
media_entity_cleanup(&subdev->entity);
kfree(mt9v032);
+
return 0;
}