Commit ca960bfe authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB: bttv: Fix mutex unbalance at bttv_poll

Don't do double mutex_unlock when reading a stream at bttv_poll.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 8822f0d6
...@@ -3162,15 +3162,14 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) ...@@ -3162,15 +3162,14 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
return videobuf_poll_stream(file, &fh->vbi, wait); return videobuf_poll_stream(file, &fh->vbi, wait);
} }
mutex_lock(&fh->cap.vb_lock);
if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { if (check_btres(fh,RESOURCE_VIDEO_STREAM)) {
mutex_lock(&fh->cap.vb_lock);
/* streaming capture */ /* streaming capture */
if (list_empty(&fh->cap.stream)) if (list_empty(&fh->cap.stream))
goto err; goto err;
buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
} else { } else {
/* read() capture */ /* read() capture */
mutex_lock(&fh->cap.vb_lock);
if (NULL == fh->cap.read_buf) { if (NULL == fh->cap.read_buf) {
/* need to capture a new frame */ /* need to capture a new frame */
if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM))
...@@ -3188,7 +3187,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) ...@@ -3188,7 +3187,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
fh->cap.read_off = 0; fh->cap.read_off = 0;
} }
mutex_unlock(&fh->cap.vb_lock);
buf = (struct bttv_buffer*)fh->cap.read_buf; buf = (struct bttv_buffer*)fh->cap.read_buf;
} }
......
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