Re: [PATCH] media: chips-media: wave5: fix a potential memory leak in wave5_vdi_init()

From: Nicolas Dufresne

Date: Thu Mar 19 2026 - 13:46:20 EST


Hi,

Le dimanche 25 janvier 2026 à 22:19 +0800, Haoxiang Li a écrit :
> Add wave5_vdi_free_dma_memory() in the error path of
> wave5_vdi_init() to prevent a potential memory leak.
>
> Fixes: 45d1a2b93277 ("media: chips-media: wave5: Add vpuapi layer")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Haoxiang Li <lihaoxiang@xxxxxxxxxxxxxxxx>

It would have been nice to reply to Greg, that being said, I carefully reviewed
and this effectively fix a leak in an error path. Description is brief but
sufficient in my opinion.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>

> ---
>  drivers/media/platform/chips-media/wave5/wave5-vdi.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vdi.c b/drivers/media/platform/chips-media/wave5/wave5-vdi.c
> index bb13267ced38..8f71920a8a35 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vdi.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vdi.c
> @@ -49,6 +49,7 @@ int wave5_vdi_init(struct device *dev)
>  
>   if (!PRODUCT_CODE_W_SERIES(vpu_dev->product_code)) {
>   WARN_ONCE(1, "unsupported product code: 0x%x\n", vpu_dev->product_code);
> + wave5_vdi_free_dma_memory(vpu_dev, &vpu_dev->common_mem);
>   return -EOPNOTSUPP;
>   }
>  

Attachment: signature.asc
Description: This is a digitally signed message part