V4L/DVB: bttv: Fix mutex unbalance at bttv_poll
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 18 Sep 2010 11:35:57 +0000 (08:35 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:06:12 +0000 (01:06 -0200)
Don't do double mutex_unlock when reading a stream at bttv_poll.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/bt8xx/bttv-driver.c

index fcafe2f1e5cf54843d515bf8b1fc1fc85b90dd6d..d74dfa6d1a554d0cdad0b39004778fdd878c9d9b 100644 (file)
@@ -3162,15 +3162,14 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
                return videobuf_poll_stream(file, &fh->vbi, wait);
        }
 
+       mutex_lock(&fh->cap.vb_lock);
        if (check_btres(fh,RESOURCE_VIDEO_STREAM)) {
-               mutex_lock(&fh->cap.vb_lock);
                /* streaming capture */
                if (list_empty(&fh->cap.stream))
                        goto err;
                buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
        } else {
                /* read() capture */
-               mutex_lock(&fh->cap.vb_lock);
                if (NULL == fh->cap.read_buf) {
                        /* need to capture a new frame */
                        if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM))
@@ -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.read_off = 0;
                }
-               mutex_unlock(&fh->cap.vb_lock);
                buf = (struct bttv_buffer*)fh->cap.read_buf;
        }