* [PATCH 1/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_lat_buffer()
2026-05-06 8:41 [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes Haoxiang Li
@ 2026-05-06 8:42 ` Haoxiang Li
2026-07-15 21:29 ` Nicolas Dufresne
2026-05-06 8:42 ` [PATCH 2/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_prob_buffer() Haoxiang Li
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Haoxiang Li @ 2026-05-06 8:42 UTC (permalink / raw)
To: tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab, matthias.bgg,
angelogioacchino.delregno, hverkuil+cisco, laurent.pinchart,
p.zabel, benjamin.gaignard, nicolas
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek, Haoxiang Li
vdec_vp9_slice_setup_lat_buffer() never fails, remove the 'return 0' from
vdec_vp9_slice_setup_lat_buffer() and modify its signature.
Also, remove the return value check in vdec_vp9_slice_setup_lat().
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
.../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
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 cd1935014d76..092fd34e21d2 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
@@ -974,7 +974,7 @@ static int vdec_vp9_slice_setup_pfc(struct vdec_vp9_slice_instance *instance,
return 0;
}
-static int vdec_vp9_slice_setup_lat_buffer(struct vdec_vp9_slice_instance *instance,
+static void vdec_vp9_slice_setup_lat_buffer(struct vdec_vp9_slice_instance *instance,
struct vdec_vp9_slice_vsi *vsi,
struct mtk_vcodec_mem *bs,
struct vdec_lat_buf *lat_buf)
@@ -1011,8 +1011,6 @@ static int vdec_vp9_slice_setup_lat_buffer(struct vdec_vp9_slice_instance *insta
vsi->row_info.buf = 0;
vsi->row_info.size = 0;
-
- return 0;
}
static int vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance *instance,
@@ -1166,9 +1164,7 @@ static int vdec_vp9_slice_setup_lat(struct vdec_vp9_slice_instance *instance,
if (ret)
goto err;
- ret = vdec_vp9_slice_setup_lat_buffer(instance, vsi, bs, lat_buf);
- if (ret)
- goto err;
+ vdec_vp9_slice_setup_lat_buffer(instance, vsi, bs, lat_buf);
vdec_vp9_slice_setup_seg_buffer(instance, vsi, &instance->seg[0]);
--
2.25.1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 1/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_lat_buffer()
2026-05-06 8:42 ` [PATCH 1/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_lat_buffer() Haoxiang Li
@ 2026-07-15 21:29 ` Nicolas Dufresne
0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Dufresne @ 2026-07-15 21:29 UTC (permalink / raw)
To: Haoxiang Li, tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab,
matthias.bgg, angelogioacchino.delregno, hverkuil+cisco,
laurent.pinchart, p.zabel, benjamin.gaignard
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]
Le mercredi 06 mai 2026 à 16:42 +0800, Haoxiang Li a écrit :
> vdec_vp9_slice_setup_lat_buffer() never fails, remove the 'return 0' from
> vdec_vp9_slice_setup_lat_buffer() and modify its signature.
> Also, remove the return value check in vdec_vp9_slice_setup_lat().
>
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> 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 cd1935014d76..092fd34e21d2 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
> @@ -974,7 +974,7 @@ static int vdec_vp9_slice_setup_pfc(struct
> vdec_vp9_slice_instance *instance,
> return 0;
> }
>
> -static int vdec_vp9_slice_setup_lat_buffer(struct vdec_vp9_slice_instance
> *instance,
> +static void vdec_vp9_slice_setup_lat_buffer(struct vdec_vp9_slice_instance
> *instance,
> struct vdec_vp9_slice_vsi *vsi,
> struct mtk_vcodec_mem *bs,
> struct vdec_lat_buf *lat_buf)
> @@ -1011,8 +1011,6 @@ static int vdec_vp9_slice_setup_lat_buffer(struct
> vdec_vp9_slice_instance *insta
>
> vsi->row_info.buf = 0;
> vsi->row_info.size = 0;
> -
> - return 0;
> }
>
> static int vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance
> *instance,
> @@ -1166,9 +1164,7 @@ static int vdec_vp9_slice_setup_lat(struct
> vdec_vp9_slice_instance *instance,
> if (ret)
> goto err;
>
> - ret = vdec_vp9_slice_setup_lat_buffer(instance, vsi, bs, lat_buf);
> - if (ret)
> - goto err;
> + vdec_vp9_slice_setup_lat_buffer(instance, vsi, bs, lat_buf);
>
> vdec_vp9_slice_setup_seg_buffer(instance, vsi, &instance->seg[0]);
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_prob_buffer()
2026-05-06 8:41 [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes Haoxiang Li
2026-05-06 8:42 ` [PATCH 1/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_lat_buffer() Haoxiang Li
@ 2026-05-06 8:42 ` Haoxiang Li
2026-07-15 21:30 ` Nicolas Dufresne
2026-05-06 8:42 ` [PATCH 3/4] media: mediatek: vcodec: free working buf on error path in vdec_vp9_slice_setup_lat() Haoxiang Li
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Haoxiang Li @ 2026-05-06 8:42 UTC (permalink / raw)
To: tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab, matthias.bgg,
angelogioacchino.delregno, hverkuil+cisco, laurent.pinchart,
p.zabel, benjamin.gaignard, nicolas
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek, Haoxiang Li
vdec_vp9_slice_setup_prob_buffer() never fails, remove 'return 0' from
vdec_vp9_slice_setup_prob_buffer() and modify its signature.
Also, remove the return value check in vdec_vp9_slice_setup_single()
and vdec_vp9_slice_setup_lat().
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
.../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
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 092fd34e21d2..0f47b2671353 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
@@ -1013,7 +1013,7 @@ static void vdec_vp9_slice_setup_lat_buffer(struct vdec_vp9_slice_instance *inst
vsi->row_info.size = 0;
}
-static int vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance *instance,
+static void vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance *instance,
struct vdec_vp9_slice_vsi *vsi)
{
struct vdec_vp9_slice_frame_ctx *frame_ctx;
@@ -1030,8 +1030,6 @@ static int vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance *inst
else
frame_ctx = vdec_vp9_slice_default_frame_ctx;
memcpy(instance->prob.va, frame_ctx, sizeof(*frame_ctx));
-
- return 0;
}
static void vdec_vp9_slice_setup_seg_buffer(struct vdec_vp9_slice_instance *instance,
@@ -1170,9 +1168,7 @@ static int vdec_vp9_slice_setup_lat(struct vdec_vp9_slice_instance *instance,
/* setup prob/tile buffers for LAT */
- ret = vdec_vp9_slice_setup_prob_buffer(instance, vsi);
- if (ret)
- goto err;
+ vdec_vp9_slice_setup_prob_buffer(instance, vsi);
ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
if (ret)
@@ -1804,10 +1800,7 @@ static int vdec_vp9_slice_setup_single(struct vdec_vp9_slice_instance *instance,
vdec_vp9_slice_setup_single_buffer(instance, pfc, vsi, bs, fb);
vdec_vp9_slice_setup_seg_buffer(instance, vsi, &instance->seg[0]);
-
- ret = vdec_vp9_slice_setup_prob_buffer(instance, vsi);
- if (ret)
- goto err;
+ vdec_vp9_slice_setup_prob_buffer(instance, vsi);
ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
if (ret)
--
2.25.1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 2/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_prob_buffer()
2026-05-06 8:42 ` [PATCH 2/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_prob_buffer() Haoxiang Li
@ 2026-07-15 21:30 ` Nicolas Dufresne
0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Dufresne @ 2026-07-15 21:30 UTC (permalink / raw)
To: Haoxiang Li, tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab,
matthias.bgg, angelogioacchino.delregno, hverkuil+cisco,
laurent.pinchart, p.zabel, benjamin.gaignard
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 2671 bytes --]
Le mercredi 06 mai 2026 à 16:42 +0800, Haoxiang Li a écrit :
> vdec_vp9_slice_setup_prob_buffer() never fails, remove 'return 0' from
> vdec_vp9_slice_setup_prob_buffer() and modify its signature.
> Also, remove the return value check in vdec_vp9_slice_setup_single()
> and vdec_vp9_slice_setup_lat().
>
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> 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 092fd34e21d2..0f47b2671353 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
> @@ -1013,7 +1013,7 @@ static void vdec_vp9_slice_setup_lat_buffer(struct
> vdec_vp9_slice_instance *inst
> vsi->row_info.size = 0;
> }
>
> -static int vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance
> *instance,
> +static void vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance
> *instance,
> struct vdec_vp9_slice_vsi *vsi)
> {
> struct vdec_vp9_slice_frame_ctx *frame_ctx;
> @@ -1030,8 +1030,6 @@ static int vdec_vp9_slice_setup_prob_buffer(struct
> vdec_vp9_slice_instance *inst
> else
> frame_ctx = vdec_vp9_slice_default_frame_ctx;
> memcpy(instance->prob.va, frame_ctx, sizeof(*frame_ctx));
> -
> - return 0;
> }
>
> static void vdec_vp9_slice_setup_seg_buffer(struct vdec_vp9_slice_instance
> *instance,
> @@ -1170,9 +1168,7 @@ static int vdec_vp9_slice_setup_lat(struct
> vdec_vp9_slice_instance *instance,
>
> /* setup prob/tile buffers for LAT */
>
> - ret = vdec_vp9_slice_setup_prob_buffer(instance, vsi);
> - if (ret)
> - goto err;
> + vdec_vp9_slice_setup_prob_buffer(instance, vsi);
>
> ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
> if (ret)
> @@ -1804,10 +1800,7 @@ static int vdec_vp9_slice_setup_single(struct
> vdec_vp9_slice_instance *instance,
>
> vdec_vp9_slice_setup_single_buffer(instance, pfc, vsi, bs, fb);
> vdec_vp9_slice_setup_seg_buffer(instance, vsi, &instance->seg[0]);
> -
> - ret = vdec_vp9_slice_setup_prob_buffer(instance, vsi);
> - if (ret)
> - goto err;
> + vdec_vp9_slice_setup_prob_buffer(instance, vsi);
>
> ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
> if (ret)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/4] media: mediatek: vcodec: free working buf on error path in vdec_vp9_slice_setup_lat()
2026-05-06 8:41 [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes Haoxiang Li
2026-05-06 8:42 ` [PATCH 1/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_lat_buffer() Haoxiang Li
2026-05-06 8:42 ` [PATCH 2/4] media: mediatek: vcodec: remove redundant return value of vdec_vp9_slice_setup_prob_buffer() Haoxiang Li
@ 2026-05-06 8:42 ` Haoxiang Li
2026-07-15 21:35 ` Nicolas Dufresne
2026-05-06 8:42 ` [PATCH 4/4] media: mediatek: vcodec: free working buf in vdec_vp9_slice_setup_single() Haoxiang Li
2026-05-06 15:02 ` [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes Nicolas Dufresne
4 siblings, 1 reply; 11+ messages in thread
From: Haoxiang Li @ 2026-05-06 8:42 UTC (permalink / raw)
To: tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab, matthias.bgg,
angelogioacchino.delregno, hverkuil+cisco, laurent.pinchart,
p.zabel, benjamin.gaignard, nicolas
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek,
Haoxiang Li, stable
Add an error path label in vdec_vp9_slice_setup_lat()
and call vdec_vp9_slice_free_working_buffer() to free
working buffer to prevent potential memory leak.
Fixes: 5d418351ca8f ("media: mediatek: vcodec: support stateless VP9 decoding")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
.../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 +++-
1 file changed, 3 insertions(+), 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 0f47b2671353..673b17d0dd8d 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
@@ -1172,10 +1172,12 @@ static int vdec_vp9_slice_setup_lat(struct vdec_vp9_slice_instance *instance,
ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
if (ret)
- goto err;
+ goto alloc_err;
return 0;
+alloc_err:
+ vdec_vp9_slice_free_working_buffer(instance);
err:
return ret;
}
--
2.25.1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 3/4] media: mediatek: vcodec: free working buf on error path in vdec_vp9_slice_setup_lat()
2026-05-06 8:42 ` [PATCH 3/4] media: mediatek: vcodec: free working buf on error path in vdec_vp9_slice_setup_lat() Haoxiang Li
@ 2026-07-15 21:35 ` Nicolas Dufresne
2026-07-15 21:46 ` Nicolas Dufresne
0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Dufresne @ 2026-07-15 21:35 UTC (permalink / raw)
To: Haoxiang Li, tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab,
matthias.bgg, angelogioacchino.delregno, hverkuil+cisco,
laurent.pinchart, p.zabel, benjamin.gaignard
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek, stable
[-- Attachment #1: Type: text/plain, Size: 1373 bytes --]
Le mercredi 06 mai 2026 à 16:42 +0800, Haoxiang Li a écrit :
> Add an error path label in vdec_vp9_slice_setup_lat()
> and call vdec_vp9_slice_free_working_buffer() to free
> working buffer to prevent potential memory leak.
>
> Fixes: 5d418351ca8f ("media: mediatek: vcodec: support stateless VP9
> decoding")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 +++-
> 1 file changed, 3 insertions(+), 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 0f47b2671353..673b17d0dd8d 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
> @@ -1172,10 +1172,12 @@ static int vdec_vp9_slice_setup_lat(struct
> vdec_vp9_slice_instance *instance,
>
> ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
> if (ret)
> - goto err;
> + goto alloc_err;
>
> return 0;
>
> +alloc_err:
> + vdec_vp9_slice_free_working_buffer(instance);
> err:
> return ret;
> }
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 3/4] media: mediatek: vcodec: free working buf on error path in vdec_vp9_slice_setup_lat()
2026-07-15 21:35 ` Nicolas Dufresne
@ 2026-07-15 21:46 ` Nicolas Dufresne
0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Dufresne @ 2026-07-15 21:46 UTC (permalink / raw)
To: Haoxiang Li, tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab,
matthias.bgg, angelogioacchino.delregno, hverkuil+cisco,
laurent.pinchart, p.zabel, benjamin.gaignard
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek, stable
[-- Attachment #1: Type: text/plain, Size: 1881 bytes --]
Hi,
Le mercredi 15 juillet 2026 à 17:35 -0400, Nicolas Dufresne a écrit :
> Le mercredi 06 mai 2026 à 16:42 +0800, Haoxiang Li a écrit :
> > Add an error path label in vdec_vp9_slice_setup_lat()
> > and call vdec_vp9_slice_free_working_buffer() to free
> > working buffer to prevent potential memory leak.
> >
> > Fixes: 5d418351ca8f ("media: mediatek: vcodec: support stateless VP9
> > decoding")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
After consideration, I will drop path 3 and 4. The working buffer is
implementing a re-alloc scheme. Even when the alloc fails, some buffer remains,
which you didn't cleanup. In the end, its not very useful to clean them up as
closing the driver FD will do that (calling IF deinit). I'll pick the two first,
as its fair cleanup.
Nicolas
>
> > ---
> > .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 +++-
> > 1 file changed, 3 insertions(+), 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 0f47b2671353..673b17d0dd8d 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
> > @@ -1172,10 +1172,12 @@ static int vdec_vp9_slice_setup_lat(struct
> > vdec_vp9_slice_instance *instance,
> >
> > ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
> > if (ret)
> > - goto err;
> > + goto alloc_err;
> >
> > return 0;
> >
> > +alloc_err:
> > + vdec_vp9_slice_free_working_buffer(instance);
> > err:
> > return ret;
> > }
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/4] media: mediatek: vcodec: free working buf in vdec_vp9_slice_setup_single()
2026-05-06 8:41 [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes Haoxiang Li
` (2 preceding siblings ...)
2026-05-06 8:42 ` [PATCH 3/4] media: mediatek: vcodec: free working buf on error path in vdec_vp9_slice_setup_lat() Haoxiang Li
@ 2026-05-06 8:42 ` Haoxiang Li
2026-07-15 21:35 ` Nicolas Dufresne
2026-05-06 15:02 ` [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes Nicolas Dufresne
4 siblings, 1 reply; 11+ messages in thread
From: Haoxiang Li @ 2026-05-06 8:42 UTC (permalink / raw)
To: tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab, matthias.bgg,
angelogioacchino.delregno, hverkuil+cisco, laurent.pinchart,
p.zabel, benjamin.gaignard, nicolas
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek,
Haoxiang Li, stable
Add an error path label in vdec_vp9_slice_setup_single()
and call vdec_vp9_slice_free_working_buffer() to free
working buffer.
Fixes: b0f407c19648 ("media: mediatek: vcodec: add vp9 decoder driver for mt8186")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
.../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 +++-
1 file changed, 3 insertions(+), 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 673b17d0dd8d..1dd0f7fd642f 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
@@ -1806,10 +1806,12 @@ static int vdec_vp9_slice_setup_single(struct vdec_vp9_slice_instance *instance,
ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
if (ret)
- goto err;
+ goto alloc_err;
return 0;
+alloc_err:
+ vdec_vp9_slice_free_working_buffer(instance);
err:
return ret;
}
--
2.25.1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 4/4] media: mediatek: vcodec: free working buf in vdec_vp9_slice_setup_single()
2026-05-06 8:42 ` [PATCH 4/4] media: mediatek: vcodec: free working buf in vdec_vp9_slice_setup_single() Haoxiang Li
@ 2026-07-15 21:35 ` Nicolas Dufresne
0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Dufresne @ 2026-07-15 21:35 UTC (permalink / raw)
To: Haoxiang Li, tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab,
matthias.bgg, angelogioacchino.delregno, hverkuil+cisco,
laurent.pinchart, p.zabel, benjamin.gaignard
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek, stable
[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]
Le mercredi 06 mai 2026 à 16:42 +0800, Haoxiang Li a écrit :
> Add an error path label in vdec_vp9_slice_setup_single()
> and call vdec_vp9_slice_free_working_buffer() to free
> working buffer.
>
> Fixes: b0f407c19648 ("media: mediatek: vcodec: add vp9 decoder driver for
> mt8186")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 +++-
> 1 file changed, 3 insertions(+), 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 673b17d0dd8d..1dd0f7fd642f 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
> @@ -1806,10 +1806,12 @@ static int vdec_vp9_slice_setup_single(struct
> vdec_vp9_slice_instance *instance,
>
> ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
> if (ret)
> - goto err;
> + goto alloc_err;
>
> return 0;
>
> +alloc_err:
> + vdec_vp9_slice_free_working_buffer(instance);
> err:
> return ret;
> }
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes
2026-05-06 8:41 [PATCH 0/4] media: mediatek: vcodec: VP9 slice setup cleanups and fixes Haoxiang Li
` (3 preceding siblings ...)
2026-05-06 8:42 ` [PATCH 4/4] media: mediatek: vcodec: free working buf in vdec_vp9_slice_setup_single() Haoxiang Li
@ 2026-05-06 15:02 ` Nicolas Dufresne
4 siblings, 0 replies; 11+ messages in thread
From: Nicolas Dufresne @ 2026-05-06 15:02 UTC (permalink / raw)
To: Haoxiang Li, tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab,
matthias.bgg, angelogioacchino.delregno, hverkuil+cisco,
laurent.pinchart, p.zabel, benjamin.gaignard
Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]
Hi,
Le mercredi 06 mai 2026 à 16:41 +0800, Haoxiang Li a écrit :
> Patches 1 and 2 change the signatures of two functions to void, removing
> the now-unnecessary return value and its associated dead error checks.
> Patches 3 and 4 add missing memory release operations in error paths,
> fixing resource leaks.
>
> These patches are carried out under the guidance of Nicolas Dufresne.
> Thanks, Nicolas!
Thanks a lot for the patches. Something to improve, as I suppose you are fairly
knew to this, is that when sending a new version of a existing patch, we try and
make it clear and make version the subjects (e.g. [PATCH v2 ...) and in the
cover letter, we summarize the changes from v1 -> v2. If you use tools like b4,
the process become painless. Meanwhile, this is fresh in my memory, so its fine.
cheers,
Nicolas
>
> Haoxiang Li (4):
> media: mediatek: vcodec: remove redundant return value of
> vdec_vp9_slice_setup_lat_buffer()
> media: mediatek: vcodec: remove redundant return value of
> vdec_vp9_slice_setup_prob_buffer()
> media: mediatek: vcodec: free working buf on error path in
> vdec_vp9_slice_setup_lat()
> media: mediatek: vcodec: free working buf in
> vdec_vp9_slice_setup_single()
>
> .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 29 +++++++------------
> 1 file changed, 11 insertions(+), 18 deletions(-)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread