mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 11:55:28 +02:00
media: mediatek: vcodec: Only free buffer VA that is not NULL
[ Upstream commit eb005c801e
]
In the MediaTek vcodec driver, while mtk_vcodec_mem_free() is mostly
called only when the buffer to free exists, there are some instances
that didn't do the check and triggered warnings in practice.
We believe those checks were forgotten unintentionally. Add the checks
back to fix the warnings.
Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b502d4a088
commit
5c217253c7
|
@ -1023,17 +1023,25 @@ static void vdec_av1_slice_free_working_buffer(struct vdec_av1_slice_instance *i
|
|||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(instance->mv); i++)
|
||||
if (instance->mv[i].va)
|
||||
mtk_vcodec_mem_free(ctx, &instance->mv[i]);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(instance->seg); i++)
|
||||
if (instance->seg[i].va)
|
||||
mtk_vcodec_mem_free(ctx, &instance->seg[i]);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(instance->cdf); i++)
|
||||
if (instance->cdf[i].va)
|
||||
mtk_vcodec_mem_free(ctx, &instance->cdf[i]);
|
||||
|
||||
|
||||
if (instance->tile.va)
|
||||
mtk_vcodec_mem_free(ctx, &instance->tile);
|
||||
if (instance->cdf_temp.va)
|
||||
mtk_vcodec_mem_free(ctx, &instance->cdf_temp);
|
||||
if (instance->cdf_table.va)
|
||||
mtk_vcodec_mem_free(ctx, &instance->cdf_table);
|
||||
if (instance->iq_table.va)
|
||||
mtk_vcodec_mem_free(ctx, &instance->iq_table);
|
||||
|
||||
instance->level = AV1_RES_NONE;
|
||||
|
|
|
@ -301,10 +301,11 @@ static void h264_enc_free_work_buf(struct venc_h264_inst *inst)
|
|||
* other buffers need to be freed by AP.
|
||||
*/
|
||||
for (i = 0; i < VENC_H264_VPU_WORK_BUF_MAX; i++) {
|
||||
if (i != VENC_H264_VPU_WORK_BUF_SKIP_FRAME)
|
||||
if (i != VENC_H264_VPU_WORK_BUF_SKIP_FRAME && inst->work_bufs[i].va)
|
||||
mtk_vcodec_mem_free(inst->ctx, &inst->work_bufs[i]);
|
||||
}
|
||||
|
||||
if (inst->pps_buf.va)
|
||||
mtk_vcodec_mem_free(inst->ctx, &inst->pps_buf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user