Re: [PATCH v2 3/7] media: verisilicon: h264: Use alloc/free helpers for auxiliary buffers
From: Nicolas Dufresne
Date: Fri Nov 20 2026 - 18:00:43 EST
Le vendredi 20 novembre 2026 à 16:13 +0100, Benjamin Gaignard a écrit :
> Simplify and clean up the code by using the helpers.
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxxxxx>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>
> ---
> drivers/media/platform/verisilicon/hantro_h264.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/platform/verisilicon/hantro_h264.c b/drivers/media/platform/verisilicon/hantro_h264.c
> index 2414782f1eb6..68dde1cd1ac2 100644
> --- a/drivers/media/platform/verisilicon/hantro_h264.c
> +++ b/drivers/media/platform/verisilicon/hantro_h264.c
> @@ -494,26 +494,21 @@ int hantro_h264_dec_prepare_run(struct hantro_ctx *ctx)
>
> void hantro_h264_dec_exit(struct hantro_ctx *ctx)
> {
> - struct hantro_dev *vpu = ctx->dev;
> struct hantro_h264_dec_hw_ctx *h264_dec = &ctx->h264_dec;
> struct hantro_aux_buf *priv = &h264_dec->priv;
>
> - dma_free_coherent(vpu->dev, priv->size, priv->cpu, priv->dma);
> + hantro_free_aux_buf(ctx, priv);
> }
>
> int hantro_h264_dec_init(struct hantro_ctx *ctx)
> {
> - struct hantro_dev *vpu = ctx->dev;
> struct hantro_h264_dec_hw_ctx *h264_dec = &ctx->h264_dec;
> struct hantro_aux_buf *priv = &h264_dec->priv;
> struct hantro_h264_dec_priv_tbl *tbl;
>
> - priv->cpu = dma_alloc_coherent(vpu->dev, sizeof(*tbl), &priv->dma,
> - GFP_KERNEL);
> - if (!priv->cpu)
> + if (hantro_allocate_aux_buf(ctx, priv, sizeof(*tbl)))
> return -ENOMEM;
EINVAL is masked.
>
> - priv->size = sizeof(*tbl);
> tbl = priv->cpu;
> memcpy(tbl->cabac_table, h264_cabac_table, sizeof(tbl->cabac_table));
>
Attachment:
signature.asc
Description: This is a digitally signed message part