From: Paul Kocialkowski <paulk@sys-base.io>
To: 박명훈 <mhun512@gmail.com>
Cc: Maxime Ripard <mripard@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Ijae Kim <ae878000@gmail.com>
Subject: Re: [PATCH v2] media: cedrus: clean up media device on probe failure
Date: Tue, 5 May 2026 15:09:26 +0200 [thread overview]
Message-ID: <afnsBu1nepWi8yy_@shepard> (raw)
In-Reply-To: <20260430142534.12928-1-pakmyeonghun@bagmyeonghun-ui-MacBookPro.local>
[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]
Hi,
On Thu 30 Apr 26, 23:25, 박명훈 wrote:
> From: Myeonghun Pak <mhun512@gmail.com>
>
> 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.
The label should be named "err_media" instead of "err_media_cleanup" to be
consistent with the other labels. With that fixed:
Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
Thanks for the fix!
Paul
> Fixes: 50e761516f2b8c ("media: platform: Add Cedrus VPU decoder driver")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
> Changes in v2:
> - Drop the now-unused err_m2m label.
>
> drivers/staging/media/sunxi/cedrus/cedrus.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> 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,7 @@ static int cedrus_probe(struct platform_device *pdev)
> v4l2_m2m_unregister_media_controller(dev->m2m_dev);
> err_video:
> video_unregister_device(&dev->vfd);
> -err_m2m:
> +err_media_cleanup:
> + media_device_cleanup(&dev->mdev);
> v4l2_m2m_release(dev->m2m_dev);
> err_v4l2:
> --
> 2.50.1
--
Paul Kocialkowski,
Independent contractor - sys-base - https://www.sys-base.io/
Free software developer - https://www.paulk.fr/
Expert in multimedia, graphics and embedded hardware support with Linux.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-05-05 13:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 14:25 [PATCH v2] media: cedrus: clean up media device on probe failure 박명훈
2026-05-05 13:09 ` Paul Kocialkowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=afnsBu1nepWi8yy_@shepard \
--to=paulk@sys-base.io \
--cc=ae878000@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-sunxi@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=mhun512@gmail.com \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=stable@vger.kernel.org \
--cc=wens@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox