Skip to content

Commit

Permalink
[media] saa7164: poll mask set incorrectly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Steven Toth <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
error27 authored and Mauro Carvalho Chehab committed Jul 27, 2011
1 parent 050bf0f commit 061d55e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions drivers/media/video/saa7164/saa7164-encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions drivers/media/video/saa7164/saa7164-vbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 061d55e

Please sign in to comment.