Skip to content

Commit

Permalink
[media] mem2mem_testdev: unlock and return error code properly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Aug 15, 2012
1 parent e36c92f commit a7bd775
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/media/platform/mem2mem_testdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_num_bufs, NULL);
if (hdl->error) {
int err = hdl->error;

rc = hdl->error;
v4l2_ctrl_handler_free(hdl);
return err;
goto open_unlock;
}
ctx->fh.ctrl_handler = hdl;
v4l2_ctrl_handler_setup(hdl);
Expand Down Expand Up @@ -946,7 +945,7 @@ static int m2mtest_open(struct file *file)

open_unlock:
mutex_unlock(&dev->dev_mutex);
return 0;
return rc;
}

static int m2mtest_release(struct file *file)
Expand Down

0 comments on commit a7bd775

Please sign in to comment.