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

Subject: media: amphion: Use vb2_get_buffer() instead of directly access to 
buffers array
Author:  Benjamin Gaignard <benjamin.gaign...@collabora.com>
Date:    Thu Nov 9 17:29:21 2023 +0100

Use vb2_get_buffer() instead of direct access to the vb2_queue bufs array.
This allows us to change the type of the bufs in the future.
After each call to vb2_get_buffer() we need to be sure that we get
a valid pointer so check the return value of all of them.

Signed-off-by: Benjamin Gaignard <benjamin.gaign...@collabora.com>
Reviewed-by: Andrzej Pietrasiewicz <andrze...@collabora.com>
CC: Ming Qian <ming.q...@nxp.com>
CC: Zhou Peng <eagle.z...@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mche...@kernel.org>

 drivers/media/platform/amphion/vpu_dbg.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

---

diff --git a/drivers/media/platform/amphion/vpu_dbg.c 
b/drivers/media/platform/amphion/vpu_dbg.c
index 982c2c777484..a462d6fe4ea9 100644
--- a/drivers/media/platform/amphion/vpu_dbg.c
+++ b/drivers/media/platform/amphion/vpu_dbg.c
@@ -140,11 +140,18 @@ static int vpu_dbg_instance(struct seq_file *s, void 
*data)
 
        vq = v4l2_m2m_get_src_vq(inst->fh.m2m_ctx);
        for (i = 0; i < vq->num_buffers; i++) {
-               struct vb2_buffer *vb = vq->bufs[i];
-               struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+               struct vb2_buffer *vb;
+               struct vb2_v4l2_buffer *vbuf;
+
+               vb = vb2_get_buffer(vq, i);
+               if (!vb)
+                       continue;
 
                if (vb->state == VB2_BUF_STATE_DEQUEUED)
                        continue;
+
+               vbuf = to_vb2_v4l2_buffer(vb);
+
                num = scnprintf(str, sizeof(str),
                                "output [%2d] state = %10s, %8s\n",
                                i, vb2_stat_name[vb->state],
@@ -155,11 +162,18 @@ static int vpu_dbg_instance(struct seq_file *s, void 
*data)
 
        vq = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx);
        for (i = 0; i < vq->num_buffers; i++) {
-               struct vb2_buffer *vb = vq->bufs[i];
-               struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+               struct vb2_buffer *vb;
+               struct vb2_v4l2_buffer *vbuf;
+
+               vb = vb2_get_buffer(vq, i);
+               if (!vb)
+                       continue;
 
                if (vb->state == VB2_BUF_STATE_DEQUEUED)
                        continue;
+
+               vbuf = to_vb2_v4l2_buffer(vb);
+
                num = scnprintf(str, sizeof(str),
                                "capture[%2d] state = %10s, %8s\n",
                                i, vb2_stat_name[vb->state],

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

Reply via email to