diff mbox series

[v4,3/4] media: videobuf2-core: reverse the iteration order in __vb2_buf_dmabuf_put

Message ID 20240614073702.316810-4-yunkec@chromium.org (mailing list archive)
State New
Headers show
Series media: videobuf2-core: attach once if multiple planes share the same dbuf | expand

Commit Message

Yunke Cao June 14, 2024, 7:37 a.m. UTC
Release the planes from num_planes - 1 to 0.

Signed-off-by: Yunke Cao <yunkec@chromium.org>
---
v3:
- Change local variable to an integer to make the code cleaner.
---
 drivers/media/common/videobuf2/videobuf2-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index a4fbc7a57ee0..cbc8928f0418 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -324,9 +324,9 @@  static void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct vb2_plane *p)
  */
 static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb)
 {
-	unsigned int plane;
+	int plane;
 
-	for (plane = 0; plane < vb->num_planes; ++plane)
+	for (plane = vb->num_planes - 1; plane >= 0; --plane)
 		__vb2_plane_dmabuf_put(vb, &vb->planes[plane]);
 }