Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mediatek: vcodec: Setting lat buf to lat_list when lat decode error

Need to set lat buf to lat_list when lat decode error, or lat buffer will
be lost.

Fixes: 5d418351ca8f ("media: mediatek: vcodec: support stateless VP9 decoding")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Yunfei Dong and committed by
Mauro Carvalho Chehab
12ac20d6 23d677bd

+10 -5
+10 -5
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c
··· 2073 2073 return -EBUSY; 2074 2074 } 2075 2075 pfc = (struct vdec_vp9_slice_pfc *)lat_buf->private_data; 2076 - if (!pfc) 2077 - return -EINVAL; 2076 + if (!pfc) { 2077 + ret = -EINVAL; 2078 + goto err_free_fb_out; 2079 + } 2078 2080 vsi = &pfc->vsi; 2079 2081 2080 2082 ret = vdec_vp9_slice_setup_lat(instance, bs, lat_buf, pfc); 2081 2083 if (ret) { 2082 2084 mtk_vcodec_err(instance, "Failed to setup VP9 lat ret %d\n", ret); 2083 - return ret; 2085 + goto err_free_fb_out; 2084 2086 } 2085 2087 vdec_vp9_slice_vsi_to_remote(vsi, instance->vsi); 2086 2088 2087 2089 ret = vpu_dec_start(&instance->vpu, NULL, 0); 2088 2090 if (ret) { 2089 2091 mtk_vcodec_err(instance, "Failed to dec VP9 ret %d\n", ret); 2090 - return ret; 2092 + goto err_free_fb_out; 2091 2093 } 2092 2094 2093 2095 if (instance->irq) { ··· 2109 2107 /* LAT trans full, no more UBE or decode timeout */ 2110 2108 if (ret) { 2111 2109 mtk_vcodec_err(instance, "VP9 decode error: %d\n", ret); 2112 - return ret; 2110 + goto err_free_fb_out; 2113 2111 } 2114 2112 2115 2113 mtk_vcodec_debug(instance, "lat dma addr: 0x%lx 0x%lx\n", ··· 2122 2120 vdec_msg_queue_qbuf(&ctx->dev->msg_queue_core_ctx, lat_buf); 2123 2121 2124 2122 return 0; 2123 + err_free_fb_out: 2124 + vdec_msg_queue_qbuf(&ctx->msg_queue.lat_ctx, lat_buf); 2125 + return ret; 2125 2126 } 2126 2127 2127 2128 static int vdec_vp9_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,