Skip to contentSkip to conversation

media: mediatek: vcodec: Handle invalid decoder vsi

PATCH In review Irui Wang 2 participants 2 messages Mar 21, 2024

Subsystems (3)
lore
Share & tools
lore

Irui Wang

author
#0 lore raw

PATCH v2 1/1 media: mediatek: vcodec: Handle invalid decoder vsi

Handle invalid decoder vsi in vpu_dec_init to ensure the decoder vsi is valid for future use.

Fixes 590577a4e525 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver")

---
changed with v1:
- add Fixes tag

---
 .../media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c    | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +6 -0
index 82e57ae983d5..17770993fe5a 100644
@@ -231,6 +231,12 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)
 	mtk_vdec_debug(vpu->ctx, "vdec_inst=%p", vpu);
 
 	err = vcodec_vpu_send_msg(vpu, (void *)&msg, sizeof(msg));
+
+	if (IS_ERR_OR_NULL(vpu->vsi)) {
+		mtk_vdec_err(vpu->ctx, "invalid vdec vsi, status=%d", err);
+		return -EINVAL;
+	}
+
 	mtk_vdec_debug(vpu->ctx, "- ret=%d", err);
 	return err;
 }
Signature · 1 line
2.18.0
maintainer Reviewed-by on v2 1/1
#1 lore raw

Il 21/03/24 02:47, Irui Wang ha scritto:

Quoted 5 lines

Handle invalid decoder vsi in vpu_dec_init to ensure the decoder vsi is valid for future use.

Fixes 590577a4e525 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver")

There shouldn't be extra lines between Fixes: and S-o-b: tags, but I guess this can be fixed while applying the patch.

Quoted 1 line