aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/mem2mem_testdev.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-08-14 01:58:56 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-15 17:50:27 -0400
commita7bd775628006f7da1b94d7a5def6746f55f2321 (patch)
treedc017300a1cecfbac681cd3d9abc38129db841d9 /drivers/media/platform/mem2mem_testdev.c
parente36c92fd63bb4773e6f4bc38ecee11a609ded1cf (diff)
[media] mem2mem_testdev: unlock and return error code properly
We recently added locking to this function, but there was an error path which accidentally returned holding a lock. Also we returned zero on failure on some paths instead of the error code. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/mem2mem_testdev.c')
-rw-r--r--drivers/media/platform/mem2mem_testdev.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/media/platform/mem2mem_testdev.c b/drivers/media/platform/mem2mem_testdev.c
index 6d0d2fb11bbe..51b6dd4ddbf7 100644
--- a/drivers/media/platform/mem2mem_testdev.c
+++ b/drivers/media/platform/mem2mem_testdev.c
@@ -911,10 +911,9 @@ static int m2mtest_open(struct file *file)
911 v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_time_msec, NULL); 911 v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_time_msec, NULL);
912 v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_num_bufs, NULL); 912 v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_num_bufs, NULL);
913 if (hdl->error) { 913 if (hdl->error) {
914 int err = hdl->error; 914 rc = hdl->error;
915
916 v4l2_ctrl_handler_free(hdl); 915 v4l2_ctrl_handler_free(hdl);
917 return err; 916 goto open_unlock;
918 } 917 }
919 ctx->fh.ctrl_handler = hdl; 918 ctx->fh.ctrl_handler = hdl;
920 v4l2_ctrl_handler_setup(hdl); 919 v4l2_ctrl_handler_setup(hdl);
@@ -946,7 +945,7 @@ static int m2mtest_open(struct file *file)
946 945
947open_unlock: 946open_unlock:
948 mutex_unlock(&dev->dev_mutex); 947 mutex_unlock(&dev->dev_mutex);
949 return 0; 948 return rc;
950} 949}
951 950
952static int m2mtest_release(struct file *file) 951static int m2mtest_release(struct file *file)