Skip to content

Commit dbd3e4a

Browse files
irui-wanggregkh
authored andcommitted
media: mediatek: vcodec: Handle invalid decoder vsi
commit 59d438f8e02ca641c58d77e1feffa000ff809e9f upstream. Handle an invalid decoder vsi in vpu_dec_init to ensure the decoder vsi is valid for future use. Fixes: 590577a ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver") Signed-off-by: Irui Wang <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Sebastian Fricke <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> [ Replace mtk_vdec_err with mtk_vcodec_err to make it work on 6.1.y ] Signed-off-by: Alva Lan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 30652c8 commit dbd3e4a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)
213213
mtk_vcodec_debug(vpu, "vdec_inst=%p", vpu);
214214

215215
err = vcodec_vpu_send_msg(vpu, (void *)&msg, sizeof(msg));
216+
217+
if (IS_ERR_OR_NULL(vpu->vsi)) {
218+
mtk_vcodec_err(vpu, "invalid vdec vsi, status=%d", err);
219+
return -EINVAL;
220+
}
221+
216222
mtk_vcodec_debug(vpu, "- ret=%d", err);
217223
return err;
218224
}

0 commit comments

Comments
 (0)