Re: [PATCH v2 2/3] media: videobuf2-core: reverse the iteration order in __vb2_buf_dmabuf_put

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/04/2024 11:13, Yunke Cao wrote:
> Release the planes from num_planes - 1 to 0.
> 
> Signed-off-by: Yunke Cao <yunkec@xxxxxxxxxxxx>
> ---
>  drivers/media/common/videobuf2/videobuf2-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
> index 702f7b6f783a..a5368cef73bb 100644
> --- a/drivers/media/common/videobuf2/videobuf2-core.c
> +++ b/drivers/media/common/videobuf2/videobuf2-core.c
> @@ -320,10 +320,10 @@ 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;
> +	unsigned int i;
>  
> -	for (plane = 0; plane < vb->num_planes; ++plane)
> -		__vb2_plane_dmabuf_put(vb, &vb->planes[plane]);
> +	for (i = 0; i < vb->num_planes; ++i)
> +		__vb2_plane_dmabuf_put(vb, &vb->planes[vb->num_planes - 1 - i]);

This is a bit ugly. Why not just do:

	for (plane = vb->num_planes; plane; plane--)
		__vb2_plane_dmabuf_put(vb, &vb->planes[plane - 1]);

Regards,

	Hans

>  }
>  
>  /*





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux