Commit a7bd7756 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab

[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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e36c92fd
...@@ -911,10 +911,9 @@ static int m2mtest_open(struct file *file) ...@@ -911,10 +911,9 @@ static int m2mtest_open(struct file *file)
v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_time_msec, NULL); v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_time_msec, NULL);
v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_num_bufs, NULL); v4l2_ctrl_new_custom(hdl, &m2mtest_ctrl_trans_num_bufs, NULL);
if (hdl->error) { if (hdl->error) {
int err = hdl->error; rc = hdl->error;
v4l2_ctrl_handler_free(hdl); v4l2_ctrl_handler_free(hdl);
return err; goto open_unlock;
} }
ctx->fh.ctrl_handler = hdl; ctx->fh.ctrl_handler = hdl;
v4l2_ctrl_handler_setup(hdl); v4l2_ctrl_handler_setup(hdl);
...@@ -946,7 +945,7 @@ static int m2mtest_open(struct file *file) ...@@ -946,7 +945,7 @@ static int m2mtest_open(struct file *file)
open_unlock: open_unlock:
mutex_unlock(&dev->dev_mutex); mutex_unlock(&dev->dev_mutex);
return 0; return rc;
} }
static int m2mtest_release(struct file *file) static int m2mtest_release(struct file *file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment