Re: [PATCH] media: cedrus: clean up media device on probe failure

From: Nicolas Dufresne

Date: Wed Apr 29 2026 - 15:08:11 EST


Le lundi 27 avril 2026 à 19:00 +0900, 박명훈 a écrit :
> From: Myeonghun Pak <mhun512@xxxxxxxxx>
>
> cedrus_probe() initializes the media device before registering the video
> device, the media controller, and the media device. If any of those later
> steps fails, probe returns without calling media_device_cleanup(), so the
> media device internals initialized by media_device_init() are left behind.
>
> Add a media-device cleanup label to the probe unwind path and route video
> registration failures through it as well.
>
> Fixes: 50e761516f2b8c ("media: platform: Add Cedrus VPU decoder driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
> ---
>  drivers/staging/media/sunxi/cedrus/cedrus.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
> index 6600245dff..2c25654640 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
> @@ -507,7 +507,7 @@ static int cedrus_probe(struct platform_device *pdev)
>   ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0);
>   if (ret) {
>   v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
> - goto err_m2m;
> + goto err_media_cleanup;
>   }
>  
>   v4l2_info(&dev->v4l2_dev,
> @@ -533,6 +533,8 @@ static int cedrus_probe(struct platform_device *pdev)
>   v4l2_m2m_unregister_media_controller(dev->m2m_dev);
>  err_video:
>   video_unregister_device(&dev->vfd);
> +err_media_cleanup:
> + media_device_cleanup(&dev->mdev);
>  err_m2m:

This label is left unused. Can you fix this warning please.

Nicolas

>   v4l2_m2m_release(dev->m2m_dev);
>  err_v4l2:

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