@@ -1989,22 +1989,23 @@ static int vdec_vp9_slice_get_param(void *h_vdec, enum vdec_get_param_type type,
static int vdec_vp9_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
struct vdec_fb *fb, bool *res_chg)
{
- struct vdec_vp9_slice_instance *instance = h_vdec;
- struct vdec_vp9_slice_pfc *pfc = &instance->sc_pfc;
+ struct vdec_vp9_slice_instance *instance;
+ struct vdec_vp9_slice_pfc *pfc;
struct vdec_vp9_slice_vsi *vsi;
struct mtk_vcodec_ctx *ctx;
int ret;
- ctx = instance->ctx;
-
/* bs NULL means flush decoder */
if (!bs)
return vdec_vp9_slice_flush(h_vdec, bs, fb, res_chg);
+ instance = h_vdec;
+ ctx = instance->ctx;
fb = ctx->dev->vdec_pdata->get_cap_buffer(ctx);
if (!fb)
return -EBUSY;
+ pfc = &instance->sc_pfc;
vsi = &pfc->vsi;
ret = vdec_vp9_slice_setup_single(instance, bs, fb, pfc);
Date: Mon, 17 Apr 2023 14:19:13 +0200 The addresses which were assigned to the variables “instance”, “pfc” and “ctx” would not be used if a null pointer was passed by the input parameter “bs”. Thus move these assignments behind corresponding pointer checks. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- .../platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.40.0