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

Commit 7af8d69

Browse files
Yunke Caogregkh
authored andcommitted
media: videobuf2-core: clear memory related fields in __vb2_plane_dmabuf_put()
[ Upstream commit 6a9c97a ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent a39416d commit 7af8d69

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
@@ -302,6 +302,10 @@ static void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct vb2_plane *p)
302302
p->mem_priv = NULL;
303303
p->dbuf = NULL;
304304
p->dbuf_mapped = 0;
305+
p->bytesused = 0;
306+
p->length = 0;
307+
p->m.fd = 0;
308+
p->data_offset = 0;
305309
}
306310

307311
/*
@@ -1296,10 +1300,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb)
12961300

12971301
/* Release previously acquired memory if present */
12981302
__vb2_plane_dmabuf_put(vb, &vb->planes[plane]);
1299-
vb->planes[plane].bytesused = 0;
1300-
vb->planes[plane].length = 0;
1301-
vb->planes[plane].m.fd = 0;
1302-
vb->planes[plane].data_offset = 0;
13031303

13041304
/* Acquire each plane's memory */
13051305
mem_priv = call_ptr_memop(attach_dmabuf,

0 commit comments

Comments
 (0)