aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/v4l2-mem2mem.c
diff options
context:
space:
mode:
authorAlexandre Courbot <gnurou@gmail.com>2020-08-27 14:49:45 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-09-26 10:17:15 +0200
commit566463afdbc43c7744c5a1b89250fc808df03833 (patch)
tree7e528630143aefb41f717fa9a5db37e3a49b643d /drivers/media/v4l2-core/v4l2-mem2mem.c
parentmedia: mx2_emmaprp: Fix memleak in emmaprp_probe (diff)
downloadlinux-dev-566463afdbc43c7744c5a1b89250fc808df03833.tar.xz
linux-dev-566463afdbc43c7744c5a1b89250fc808df03833.zip
media: v4l2-mem2mem: always consider OUTPUT queue during poll
If poll() is called on a m2m device with the EPOLLOUT event after the last buffer of the CAPTURE queue is dequeued, any buffer available on OUTPUT queue will never be signaled because v4l2_m2m_poll_for_data() starts by checking whether dst_q->last_buffer_dequeued is set and returns EPOLLIN in this case, without looking at the state of the OUTPUT queue. Fix this by not early returning so we keep checking the state of the OUTPUT queue afterwards. Signed-off-by: Alexandre Courbot <gnurou@gmail.com> Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-mem2mem.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-mem2mem.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
index 6a80240e9228..121243e5bece 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -909,10 +909,8 @@ static __poll_t v4l2_m2m_poll_for_data(struct file *file,
* If the last buffer was dequeued from the capture queue,
* return immediately. DQBUF will return -EPIPE.
*/
- if (dst_q->last_buffer_dequeued) {
- spin_unlock_irqrestore(&dst_q->done_lock, flags);
- return EPOLLIN | EPOLLRDNORM;
- }
+ if (dst_q->last_buffer_dequeued)
+ rc |= EPOLLIN | EPOLLRDNORM;
}
spin_unlock_irqrestore(&dst_q->done_lock, flags);