media: mediatek: vcodec: Handle invalid decoder vsi
Subsystems (3)
PATCH 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.
--- .../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
@@ -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
AngeloGioacchino Del Regno
maintainerIl 20/03/24 07:13, Irui Wang ha scritto:
Quoted 4 lines
Handle invalid decoder vsi in
vpu_dec_initto ensure the decoder vsi is valid for future use.Signed-off-by Irui Wang <[email protected]>
This commit needs a Fixes tag, can you please add the relevant one and resend?
Thanks,
Angelo
Quoted 21 lines
--- .../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@@ -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; }
Dear Angelo,
Thanks for your reviewing, patch v2 has been sent with 'Fixes' tag, thank you very much.
Best Regards
Quoted 40 lines · AngeloGioacchino Del Regno
Il 20/03/24 07:13, Irui Wang ha scritto:
Quoted 5 lines
Handle invalid decoder vsi in
vpu_dec_initto ensure the decoder vsi is
valid for future use.Signed-off-by Irui Wang <[email protected]>This commit needs a Fixes tag, can you please add the relevant one and resend?
Thanks,
AngeloQuoted 25 lines
--- .../media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c | 6 ++++++ 1 file changed, 6 insertions(+)diff --git
a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.cb/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.cindex82e57ae983d5..17770993fe5a100644drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +6
-0@@ -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;}
Hi,
Le mercredi 20 mars 2024 à 14:13 +0800, Irui Wang a écrit :
Quoted 13 lines
Handle invalid decoder vsi in
vpu_dec_initto ensure the decoder vsi is valid for future use.Signed-off-by Irui Wang <[email protected]>--- .../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 +0
-0
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c int vpu_dec_init(struct vdec_vpu_inst *vpu) · line 239
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +6
-0@@ -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 ; + } +
Make sense, though on the cosmetic side, were is the err value from if the vsi pointer is NULL ?
Nicolas
Quoted 3 lines
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +0
-0mtk_vdec_debug (vpu->ctx,"- ret=%d" , err);return err; }
Dear Nicolas,
Thanks for your reviewing.
Quoted 22 lines · Nicolas Dufresne
Hi,
Quoted 19 lines · Irui Wang
Handle invalid decoder vsi in
vpu_dec_initto ensure the decoder vsi is
valid for future use.Signed-off-by Irui Wang <[email protected]>--- .../media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c | 6 ++++++ 1 file changed, 6 insertions(+)diff --git
a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.cb/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.cindex82e57ae983d5..17770993fe5a100644drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +0
-0@@ -231,6 +231,12 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)mtk_vdec_debug (vpu->ctx,"vdec_inst=%p" , vpu);
Quoted 12 lines
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c int vpu_dec_init(struct vdec_vpu_inst *vpu) · line 239
Quoted 8 lines
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +6
-0err =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 ; + } +Make sense, though on the cosmetic side, were is the err value from if the vsi
pointer is NULL ?
Do you mean the returned 'err'?, it's the status value returned by 'send message'. Even if the 'vsi' is NULL, the returned status value 'err' may still be 'NO_ERROR', there is no direct relationship between them.
If I misunderstood your question, please correct me. Thank you very much.
Quoted 8 lines
Nicolas
Quoted 3 lines
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +0
-0mtk_vdec_debug (vpu->ctx,"- ret=%d" , err);return err;}