aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2015-02-26 13:05:38 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 20:28:19 -0400
commit15af4a532f7fb21f7e02973a4829735ce13190c0 (patch)
tree71c1fc3b2f7a001252a9beffa74a20198796261f /drivers/media/i2c
parent198b47ddd23498cd88f4ec2c2a050eb727cc357c (diff)
[media] media: i2c: mt9p031: make sure we destroy the mutex
Make sure to call mutex_destroy() in case of probe failure or module unload. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/mt9p031.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index e06759c6cb91..2bf0e6843955 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -1071,6 +1071,8 @@ static int mt9p031_probe(struct i2c_client *client,
1071 return ret; 1071 return ret;
1072 } 1072 }
1073 1073
1074 mutex_init(&mt9p031->power_lock);
1075
1074 v4l2_ctrl_handler_init(&mt9p031->ctrls, ARRAY_SIZE(mt9p031_ctrls) + 6); 1076 v4l2_ctrl_handler_init(&mt9p031->ctrls, ARRAY_SIZE(mt9p031_ctrls) + 6);
1075 1077
1076 v4l2_ctrl_new_std(&mt9p031->ctrls, &mt9p031_ctrl_ops, 1078 v4l2_ctrl_new_std(&mt9p031->ctrls, &mt9p031_ctrl_ops,
@@ -1108,7 +1110,6 @@ static int mt9p031_probe(struct i2c_client *client,
1108 mt9p031->blc_offset = v4l2_ctrl_find(&mt9p031->ctrls, 1110 mt9p031->blc_offset = v4l2_ctrl_find(&mt9p031->ctrls,
1109 V4L2_CID_BLC_DIGITAL_OFFSET); 1111 V4L2_CID_BLC_DIGITAL_OFFSET);
1110 1112
1111 mutex_init(&mt9p031->power_lock);
1112 v4l2_i2c_subdev_init(&mt9p031->subdev, client, &mt9p031_subdev_ops); 1113 v4l2_i2c_subdev_init(&mt9p031->subdev, client, &mt9p031_subdev_ops);
1113 mt9p031->subdev.internal_ops = &mt9p031_subdev_internal_ops; 1114 mt9p031->subdev.internal_ops = &mt9p031_subdev_internal_ops;
1114 1115
@@ -1149,6 +1150,7 @@ done:
1149 if (ret < 0) { 1150 if (ret < 0) {
1150 v4l2_ctrl_handler_free(&mt9p031->ctrls); 1151 v4l2_ctrl_handler_free(&mt9p031->ctrls);
1151 media_entity_cleanup(&mt9p031->subdev.entity); 1152 media_entity_cleanup(&mt9p031->subdev.entity);
1153 mutex_destroy(&mt9p031->power_lock);
1152 } 1154 }
1153 1155
1154 return ret; 1156 return ret;
@@ -1162,6 +1164,7 @@ static int mt9p031_remove(struct i2c_client *client)
1162 v4l2_ctrl_handler_free(&mt9p031->ctrls); 1164 v4l2_ctrl_handler_free(&mt9p031->ctrls);
1163 v4l2_device_unregister_subdev(subdev); 1165 v4l2_device_unregister_subdev(subdev);
1164 media_entity_cleanup(&subdev->entity); 1166 media_entity_cleanup(&subdev->entity);
1167 mutex_destroy(&mt9p031->power_lock);
1165 1168
1166 return 0; 1169 return 0;
1167} 1170}