This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: sti: hva: Remove useless check
Author:  Benjamin Gaignard <benjamin.gaign...@collabora.com>
Date:    Thu Nov 9 17:34:30 2023 +0100

Remove index range test since it is done by vb2_get_buffer().
vb2_get_buffer() can return a NULL pointer so we need the return
value.

Signed-off-by: Benjamin Gaignard <benjamin.gaign...@collabora.com>
CC: Jean-Christophe Trotin <jean-christophe.tro...@foss.st.com>
Reviewed-by: Andrzej Pietrasiewicz <andrze...@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mche...@kernel.org>

 drivers/media/platform/st/sti/hva/hva-v4l2.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

---

diff --git a/drivers/media/platform/st/sti/hva/hva-v4l2.c 
b/drivers/media/platform/st/sti/hva/hva-v4l2.c
index 3a848ca32a0e..cfe83e9dc01b 100644
--- a/drivers/media/platform/st/sti/hva/hva-v4l2.c
+++ b/drivers/media/platform/st/sti/hva/hva-v4l2.c
@@ -569,14 +569,11 @@ static int hva_qbuf(struct file *file, void *priv, struct 
v4l2_buffer *buf)
                struct vb2_buffer *vb2_buf;
 
                vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, buf->type);
-
-               if (buf->index >= vq->num_buffers) {
-                       dev_dbg(dev, "%s buffer index %d out of range (%d)\n",
-                               ctx->name, buf->index, vq->num_buffers);
+               vb2_buf = vb2_get_buffer(vq, buf->index);
+               if (!vb2_buf) {
+                       dev_dbg(dev, "%s buffer index %d not found\n", 
ctx->name, buf->index);
                        return -EINVAL;
                }
-
-               vb2_buf = vb2_get_buffer(vq, buf->index);
                stream = to_hva_stream(to_vb2_v4l2_buffer(vb2_buf));
                stream->bytesused = buf->bytesused;
        }

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to