Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6a9c97a

Browse files
Yunke CaoHans Verkuil
authored andcommitted
media: videobuf2-core: clear memory related fields in __vb2_plane_dmabuf_put()
Clear vb2_plane's memory related fields in __vb2_plane_dmabuf_put(), including bytesused, length, fd and data_offset. Remove the duplicated code in __prepare_dmabuf(). Signed-off-by: Yunke Cao <[email protected]> Acked-by: Tomasz Figa <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent c60f773 commit 6a9c97a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/media/common/videobuf2/videobuf2-core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ static void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct vb2_plane *p)
311311
p->mem_priv = NULL;
312312
p->dbuf = NULL;
313313
p->dbuf_mapped = 0;
314+
p->bytesused = 0;
315+
p->length = 0;
316+
p->m.fd = 0;
317+
p->data_offset = 0;
314318
}
315319

316320
/*
@@ -1420,10 +1424,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb)
14201424

14211425
/* Release previously acquired memory if present */
14221426
__vb2_plane_dmabuf_put(vb, &vb->planes[plane]);
1423-
vb->planes[plane].bytesused = 0;
1424-
vb->planes[plane].length = 0;
1425-
vb->planes[plane].m.fd = 0;
1426-
vb->planes[plane].data_offset = 0;
14271427

14281428
/* Acquire each plane's memory */
14291429
mem_priv = call_ptr_memop(attach_dmabuf,

0 commit comments

Comments
 (0)