[PATCH 09/14] media: verisilicon: Cancel job with runtime pm put/clk disable on failure

Nicolas Dufresne nicolas.dufresne at collabora.com
Tue Nov 17 13:42:35 PST 2026


Le vendredi 22 mai 2026 à 12:16 +0200, Paul Kocialkowski a écrit :
> The no-pm variant of hantro_job_finish is only good to use directly if
> runtime pm get failed. In other cases, we need to do a runtime pm put
> and bulk clk disable to correctly undo what was set up.
> 
> Fixes: 892bb6ecead9 ("media: hantro: do a PM resume earlier")
> Signed-off-by: Paul Kocialkowski <paulk at sys-base.io>

Seems already fixed by 556ab0b2741d6 ("media: hantro: release runtime resources
when device_run fails".

> ---
>  .../media/platform/verisilicon/hantro_drv.c   | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index e0c11fe8b55c..e21306f2bf2e 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -169,29 +169,34 @@ void hantro_end_prepare_run(struct hantro_ctx *ctx)
>  static void device_run(void *priv)
>  {
>  	struct hantro_ctx *ctx = priv;
> +	struct hantro_dev *vpu = ctx->dev;
>  	struct vb2_v4l2_buffer *src, *dst;
>  	int ret;
>  
>  	src = hantro_get_src_buf(ctx);
>  	dst = hantro_get_dst_buf(ctx);
>  
> -	ret = pm_runtime_resume_and_get(ctx->dev->dev);
> +	ret = pm_runtime_resume_and_get(vpu->dev);
>  	if (ret < 0)
> -		goto err_cancel_job;
> +		goto err_cancel_job_no_pm;
>  
> -	ret = clk_bulk_enable(ctx->dev->variant->num_clocks, ctx->dev->clocks);
> +	ret = clk_bulk_enable(vpu->variant->num_clocks, vpu->clocks);
>  	if (ret)
> -		goto err_cancel_job;
> +		goto err_cancel_job_pm;
>  
>  	v4l2_m2m_buf_copy_metadata(src, dst, true);
>  
>  	if (ctx->codec_ops->run(ctx))
> -		goto err_cancel_job;
> +		goto err_cancel_job_clk;
>  
>  	return;
>  
> -err_cancel_job:
> -	hantro_job_finish_no_pm(ctx->dev, ctx, VB2_BUF_STATE_ERROR);
> +err_cancel_job_clk:
> +	clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
> +err_cancel_job_pm:
> +	pm_runtime_put_autosuspend(vpu->dev);
> +err_cancel_job_no_pm:
> +	hantro_job_finish_no_pm(vpu, ctx, VB2_BUF_STATE_ERROR);
>  }
>  
>  static const struct v4l2_m2m_ops vpu_m2m_ops = {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261117/1eef8a1d/attachment-0001.sig>


More information about the linux-arm-kernel mailing list