[media] saa7164: poll mask set incorrectly
authorDan Carpenter <error27@gmail.com>
Wed, 24 Nov 2010 05:36:57 +0000 (02:36 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:52:18 +0000 (17:52 -0300)
list_first_entry() always returns non-null here.  I think the intent was
to test whether there were any entries in the used list.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7164/saa7164-encoder.c
drivers/media/video/saa7164/saa7164-vbi.c

index 4003645..2fd38a0 100644 (file)
@@ -1246,7 +1246,6 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
        struct saa7164_encoder_fh *fh =
                (struct saa7164_encoder_fh *)file->private_data;
        struct saa7164_port *port = fh->port;
-       struct saa7164_user_buffer *ubuf;
        unsigned int mask = 0;
 
        port->last_poll_msecs_diff = port->last_poll_msecs;
@@ -1278,10 +1277,7 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
        }
 
        /* Pull the first buffer from the used list */
-       ubuf = list_first_entry(&port->list_buf_used.list,
-               struct saa7164_user_buffer, list);
-
-       if (ubuf)
+       if (!list_empty(&port->list_buf_used.list))
                mask |= POLLIN | POLLRDNORM;
 
        return mask;
index bc1fced..e2e0341 100644 (file)
@@ -1192,7 +1192,6 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
 {
        struct saa7164_vbi_fh *fh = (struct saa7164_vbi_fh *)file->private_data;
        struct saa7164_port *port = fh->port;
-       struct saa7164_user_buffer *ubuf;
        unsigned int mask = 0;
 
        port->last_poll_msecs_diff = port->last_poll_msecs;
@@ -1224,10 +1223,7 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
        }
 
        /* Pull the first buffer from the used list */
-       ubuf = list_first_entry(&port->list_buf_used.list,
-               struct saa7164_user_buffer, list);
-
-       if (ubuf)
+       if (!list_empty(&port->list_buf_used.list))
                mask |= POLLIN | POLLRDNORM;
 
        return mask;