[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ab98f6df-206b-48a0-a8ec-4d105bae0e22@xs4all.nl>
Date: Wed, 11 Oct 2023 10:54:35 +0200
From: Hans Verkuil <hverkuil-cisco@...all.nl>
To: Benjamin Gaignard <benjamin.gaignard@...labora.com>,
mchehab@...nel.org, tfiga@...omium.org, m.szyprowski@...sung.com,
ming.qian@....com, ezequiel@...guardiasur.com.ar,
p.zabel@...gutronix.de, gregkh@...uxfoundation.org,
nicolas.dufresne@...labora.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
linux-rockchip@...ts.infradead.org, linux-staging@...ts.linux.dev,
kernel@...labora.com
Subject: Re: [PATCH v10 20/54] media: Remove duplicated index vs
q->num_buffers check
Subject should start with "media: videobuf2:".
Regards,
Hans
On 03/10/2023 10:06, Benjamin Gaignard wrote:
> vb2_get_buffer() already checks if the requested index is valid.
> Stop duplicating this kind of check everywhere.
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...labora.com>
> ---
> drivers/media/common/videobuf2/videobuf2-v4l2.c | 13 -------------
> 1 file changed, 13 deletions(-)
>
> diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
> index 42da0adc052a..cf881c8d8d4d 100644
> --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
> +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
> @@ -378,11 +378,6 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md
> return -EINVAL;
> }
>
> - if (b->index >= q->num_buffers) {
> - dprintk(q, 1, "%s: buffer index out of range\n", opname);
> - return -EINVAL;
> - }
> -
> vb = vb2_get_buffer(q, b->index);
> if (!vb) {
> dprintk(q, 1, "%s: buffer %u is NULL\n", opname, b->index);
> @@ -833,10 +828,6 @@ int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
> return -EBUSY;
> }
>
> - if (b->index >= q->num_buffers) {
> - dprintk(q, 1, "buffer index out of range\n");
> - return -EINVAL;
> - }
> vb = vb2_get_buffer(q, b->index);
> if (!vb) {
> dprintk(q, 1, "can't find the requested buffer %u\n", b->index);
> @@ -908,10 +899,6 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb)
> {
> struct vb2_buffer *vb;
>
> - if (eb->index >= q->num_buffers) {
> - dprintk(q, 1, "buffer index out of range\n");
> - return -EINVAL;
> - }
> vb = vb2_get_buffer(q, eb->index);
> if (!vb) {
> dprintk(q, 1, "can't find the requested buffer %u\n", eb->index);
Powered by blists - more mailing lists