[media] media: vb2: add a check for uninitialized buffer
__buffer_in_use() might be called for empty/uninitialized buffer in the following scenario: REQBUF(n, USER_PTR), QUERYBUF(). This patch fixes kernel ops in such case. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> CC: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
e836a1c078
Коммит
2c2dd6ac73
|
@ -296,14 +296,14 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb)
|
|||
{
|
||||
unsigned int plane;
|
||||
for (plane = 0; plane < vb->num_planes; ++plane) {
|
||||
void *mem_priv = vb->planes[plane].mem_priv;
|
||||
/*
|
||||
* If num_users() has not been provided, call_memop
|
||||
* will return 0, apparently nobody cares about this
|
||||
* case anyway. If num_users() returns more than 1,
|
||||
* we are not the only user of the plane's memory.
|
||||
*/
|
||||
if (call_memop(q, plane, num_users,
|
||||
vb->planes[plane].mem_priv) > 1)
|
||||
if (mem_priv && call_memop(q, plane, num_users, mem_priv) > 1)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче