mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
media: videobuf2-core: drop obsolete sanity check in __vb2_queue_free()
The sanity check in __vb2_queue_free() is obsolete ever since commit
f035eb4e97
("[media] videobuf2: fix lockdep warning"). Remove it and
let __vb2_queue_free() return void.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
1925665ef4
commit
01cb370ff6
@ -502,27 +502,11 @@ static void __vb2_free_mem(struct vb2_queue *q, unsigned int buffers)
|
||||
* related information, if no buffers are left return the queue to an
|
||||
* uninitialized state. Might be called even if the queue has already been freed.
|
||||
*/
|
||||
static int __vb2_queue_free(struct vb2_queue *q, unsigned int buffers)
|
||||
static void __vb2_queue_free(struct vb2_queue *q, unsigned int buffers)
|
||||
{
|
||||
unsigned int buffer;
|
||||
|
||||
/*
|
||||
* Sanity check: when preparing a buffer the queue lock is released for
|
||||
* a short while (see __buf_prepare for the details), which would allow
|
||||
* a race with a reqbufs which can call this function. Removing the
|
||||
* buffers from underneath __buf_prepare is obviously a bad idea, so we
|
||||
* check if any of the buffers is in the state PREPARING, and if so we
|
||||
* just return -EAGAIN.
|
||||
*/
|
||||
for (buffer = q->num_buffers - buffers; buffer < q->num_buffers;
|
||||
++buffer) {
|
||||
if (q->bufs[buffer] == NULL)
|
||||
continue;
|
||||
if (q->bufs[buffer]->state == VB2_BUF_STATE_PREPARING) {
|
||||
dprintk(q, 1, "preparing buffers, cannot free\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
}
|
||||
lockdep_assert_held(&q->mmap_lock);
|
||||
|
||||
/* Call driver-provided cleanup function for each buffer, if provided */
|
||||
for (buffer = q->num_buffers - buffers; buffer < q->num_buffers;
|
||||
@ -616,7 +600,6 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned int buffers)
|
||||
q->memory = VB2_MEMORY_UNKNOWN;
|
||||
INIT_LIST_HEAD(&q->queued_list);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb)
|
||||
@ -798,10 +781,8 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
|
||||
* queued without ever calling STREAMON.
|
||||
*/
|
||||
__vb2_queue_cancel(q);
|
||||
ret = __vb2_queue_free(q, q->num_buffers);
|
||||
__vb2_queue_free(q, q->num_buffers);
|
||||
mutex_unlock(&q->mmap_lock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* In case of REQBUFS(0) return immediately without calling
|
||||
|
Loading…
Reference in New Issue
Block a user