public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com,
	ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar,
	p.zabel@pengutronix.de, gregkh@linuxfoundation.org,
	hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-staging@lists.linux.dev, kernel@collabora.com,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>
Subject: [PATCH v6 06/18] media: mediatek: vdec: Use vb2_get_buffer() instead of directly access to buffers array
Date: Fri,  1 Sep 2023 14:44:02 +0200	[thread overview]
Message-ID: <20230901124414.48497-7-benjamin.gaignard@collabora.com> (raw)
In-Reply-To: <20230901124414.48497-1-benjamin.gaignard@collabora.com>

Use vb2_get_buffer() instead of directly access to vb2_buffer buffer array.
This could allow to change the type bufs[] field of vb2_buffer structure if
needed.
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>
---
 .../platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
index e393e3e668f8..3d2ae0e1b5b6 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
@@ -1696,7 +1696,7 @@ static int vdec_vp9_slice_setup_core_buffer(struct vdec_vp9_slice_instance *inst
 
 	/* update internal buffer's width/height */
 	for (i = 0; i < vq->num_buffers; i++) {
-		if (vb == vq->bufs[i]) {
+		if (vb == vb2_get_buffer(vq, i)) {
 			instance->dpb[i].width = w;
 			instance->dpb[i].height = h;
 			break;
-- 
2.39.2


  parent reply	other threads:[~2023-09-01 12:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 12:43 [PATCH v6 00/18] Add DELETE_BUF ioctl Benjamin Gaignard
2023-09-01 12:43 ` [PATCH v6 01/18] media: videobuf2: Rework offset 'cookie' encoding pattern Benjamin Gaignard
2023-09-01 12:43 ` [PATCH v6 02/18] media: videobuf2: Stop spamming kernel log with all queue counter Benjamin Gaignard
2023-09-04 15:17   ` Hans Verkuil
2023-09-01 12:43 ` [PATCH v6 03/18] media: videobuf2: Use vb2_buffer instead of index Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 04/18] media: amphion: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 05/18] media: mediatek: jpeg: " Benjamin Gaignard
2023-09-01 12:44 ` Benjamin Gaignard [this message]
2023-09-01 12:44 ` [PATCH v6 07/18] media: sti: hva: " Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 08/18] media: visl: " Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 09/18] media: atomisp: " Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 10/18] media: videobuf2: Access vb2_queue bufs array through helper functions Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 11/18] media: videobuf2: Be more flexible on the number of queue stored buffers Benjamin Gaignard
2023-09-04 11:24   ` Hans Verkuil
2023-09-04 11:46     ` Benjamin Gaignard
2023-09-04 14:09       ` Hans Verkuil
2023-09-04 15:05         ` Hans Verkuil
2023-09-04 15:19   ` Hans Verkuil
2023-09-01 12:44 ` [PATCH v6 12/18] media: verisilicon: Refactor postprocessor to store more buffers Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 13/18] media: verisilicon: Store chroma and motion vectors offset Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 14/18] media: verisilicon: vp9: Use destination buffer height to compute chroma offset Benjamin Gaignard
2023-09-10 13:21   ` Jernej Škrabec
2023-09-11  8:55     ` Benjamin Gaignard
2023-09-11 16:36       ` Jernej Škrabec
2023-09-12  8:41         ` Benjamin Gaignard
2023-09-12 15:26           ` Nicolas Dufresne
2023-09-12 15:51           ` Jernej Škrabec
2023-09-01 12:44 ` [PATCH v6 15/18] media: verisilicon: postproc: Fix down scale test Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 16/18] media: verisilicon: vp9: Allow to change resolution while streaming Benjamin Gaignard
2023-09-01 12:44 ` [PATCH v6 17/18] media: v4l2: Add DELETE_BUFS ioctl Benjamin Gaignard
2023-09-05  8:17   ` Hans Verkuil
2023-09-05  8:43     ` Hans Verkuil
2023-09-05 14:28     ` Benjamin Gaignard
2023-09-05 14:37       ` Hans Verkuil
2023-09-01 12:44 ` [PATCH v6 18/18] media: v4l2: Add mem2mem helpers for " Benjamin Gaignard
2023-09-04 15:23 ` [PATCH v6 00/18] Add DELETE_BUF ioctl Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230901124414.48497-7-benjamin.gaignard@collabora.com \
    --to=benjamin.gaignard@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox