Re: [PATCH 09/14] media: verisilicon: Cancel job with runtime pm put/clk disable on failure
From: Nicolas Dufresne
Date: Tue Nov 17 2026 - 16:42:56 EST
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@xxxxxxxxxxx>
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 = {
Attachment:
signature.asc
Description: This is a digitally signed message part