mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-30 19:20:26 -04:00
media: amphion: Use vb2_get_buffer() instead of directly access to buffers array
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.gaignard@collabora.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> CC: Ming Qian <ming.qian@nxp.com> CC: Zhou Peng <eagle.zhou@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
da8fc26b0b
commit
e03bcb2898
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user