linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi
@ 2024-03-20  6:13 Irui Wang
  2024-03-20  9:13 ` AngeloGioacchino Del Regno
  2024-03-22 14:44 ` Nicolas Dufresne
  0 siblings, 2 replies; 5+ messages in thread
From: Irui Wang @ 2024-03-20  6:13 UTC (permalink / raw)
  To: Hans Verkuil, Mauro Carvalho Chehab, Matthias Brugger,
	Yunfei Dong, angelogioacchino.delregno, nicolas.dufresne,
	sebastian.fricke
  Cc: Longfei Wang, Maoguang Meng, Irui Wang,
	Project_Global_Chrome_Upstream_Group, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek

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

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 .../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.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
index 82e57ae983d5..17770993fe5a 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
@@ -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;
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi
  2024-03-20  6:13 [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi Irui Wang
@ 2024-03-20  9:13 ` AngeloGioacchino Del Regno
  2024-03-21  1:55   ` Irui Wang (王瑞)
  2024-03-22 14:44 ` Nicolas Dufresne
  1 sibling, 1 reply; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-03-20  9:13 UTC (permalink / raw)
  To: Irui Wang, Hans Verkuil, Mauro Carvalho Chehab, Matthias Brugger,
	Yunfei Dong, nicolas.dufresne, sebastian.fricke
  Cc: Longfei Wang, Maoguang Meng,
	Project_Global_Chrome_Upstream_Group, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek

Il 20/03/24 07:13, Irui Wang ha scritto:
> Handle invalid decoder vsi in vpu_dec_init to ensure the decoder vsi is
> valid for future use.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>

This commit needs a Fixes tag, can you please add the relevant one and resend?

Thanks,
Angelo

> ---
>   .../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.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> index 82e57ae983d5..17770993fe5a 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> @@ -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;
>   }


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi
  2024-03-20  9:13 ` AngeloGioacchino Del Regno
@ 2024-03-21  1:55   ` Irui Wang (王瑞)
  0 siblings, 0 replies; 5+ messages in thread
From: Irui Wang (王瑞) @ 2024-03-21  1:55 UTC (permalink / raw)
  To: matthias.bgg, mchehab, sebastian.fricke,
	angelogioacchino.delregno, nicolas.dufresne, hverkuil-cisco,
	Yunfei Dong (董云飞)
  Cc: linux-arm-kernel, linux-kernel, linux-media,
	Maoguang Meng (孟毛广),
	linux-mediatek, Longfei Wang (王龙飞),
	Project_Global_Chrome_Upstream_Group

Dear Angelo,

Thanks for your reviewing, patch v2 has been sent with 'Fixes' tag,
thank you very much.

Best Regards

On Wed, 2024-03-20 at 10:13 +0100, AngeloGioacchino Del Regno wrote:
> Il 20/03/24 07:13, Irui Wang ha scritto:
> > Handle invalid decoder vsi in vpu_dec_init to ensure the decoder
> > vsi is
> > valid for future use.
> > 
> > Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> 
> This commit needs a Fixes tag, can you please add the relevant one
> and resend?
> 
> Thanks,
> Angelo
> 
> > ---
> >   .../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.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> > index 82e57ae983d5..17770993fe5a 100644
> > --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> > +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> > @@ -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;
> >   }
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi
  2024-03-20  6:13 [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi Irui Wang
  2024-03-20  9:13 ` AngeloGioacchino Del Regno
@ 2024-03-22 14:44 ` Nicolas Dufresne
  2024-03-23  1:45   ` Irui Wang (王瑞)
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Dufresne @ 2024-03-22 14:44 UTC (permalink / raw)
  To: Irui Wang, Hans Verkuil, Mauro Carvalho Chehab, Matthias Brugger,
	Yunfei Dong, angelogioacchino.delregno, sebastian.fricke
  Cc: Longfei Wang, Maoguang Meng,
	Project_Global_Chrome_Upstream_Group, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek

Hi,

Le mercredi 20 mars 2024 à 14:13 +0800, Irui Wang a écrit :
> Handle invalid decoder vsi in vpu_dec_init to ensure the decoder vsi is
> valid for future use.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>  .../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.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> index 82e57ae983d5..17770993fe5a 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> @@ -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

>  	mtk_vdec_debug(vpu->ctx, "- ret=%d", err);
>  	return err;
>  }


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi
  2024-03-22 14:44 ` Nicolas Dufresne
@ 2024-03-23  1:45   ` Irui Wang (王瑞)
  0 siblings, 0 replies; 5+ messages in thread
From: Irui Wang (王瑞) @ 2024-03-23  1:45 UTC (permalink / raw)
  To: matthias.bgg, mchehab, sebastian.fricke,
	angelogioacchino.delregno, nicolas.dufresne, hverkuil-cisco,
	Yunfei Dong (董云飞)
  Cc: linux-arm-kernel, linux-kernel, linux-media,
	Maoguang Meng (孟毛广),
	linux-mediatek, Longfei Wang (王龙飞),
	Project_Global_Chrome_Upstream_Group

Dear Nicolas,

Thanks for your reviewing.

On Fri, 2024-03-22 at 10:44 -0400, Nicolas Dufresne wrote:
> Hi,
> 
> Le mercredi 20 mars 2024 à 14:13 +0800, Irui Wang a écrit :
> > Handle invalid decoder vsi in vpu_dec_init to ensure the decoder
> > vsi is
> > valid for future use.
> > 
> > Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> > ---
> >  .../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.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> > index 82e57ae983d5..17770993fe5a 100644
> > --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> > +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c
> > @@ -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 ?

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.

> 
> Nicolas
> 
> >  	mtk_vdec_debug(vpu->ctx, "- ret=%d", err);
> >  	return err;
> >  }
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-23  1:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20  6:13 [PATCH] media: mediatek: vcodec: Handle invalid decoder vsi Irui Wang
2024-03-20  9:13 ` AngeloGioacchino Del Regno
2024-03-21  1:55   ` Irui Wang (王瑞)
2024-03-22 14:44 ` Nicolas Dufresne
2024-03-23  1:45   ` Irui Wang (王瑞)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).