Linux Media Controller development
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: Biren Pandya <birenpandya@gmail.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	 linux-kernel@vger.kernel.org, niklas.soderlund@ragnatech.se,
	mchehab@kernel.org,  geert+renesas@glider.be,
	magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com,
	 jacopo.mondi@ideasonboard.com
Subject: Re: [PATCH v3 1/4] media: renesas: rcar-csi2: Add missing media_entity_cleanup()
Date: Wed, 8 Jul 2026 17:58:33 +0200	[thread overview]
Message-ID: <ak5yyRucx7IKvcse@zed> (raw)
In-Reply-To: <20260704174638.66302-7-birenpandya@gmail.com>

Hi Biren

On Sat, Jul 04, 2026 at 11:16:40PM +0530, Biren Pandya wrote:
> The probe error paths and the remove function fail to call
> media_entity_cleanup() upon teardown.
>
> While currently a no-op in most cases, calling media_entity_cleanup()

Here and in the other patches s/in most cases//

> is an API requirement for entities initialized with media_entity_pads_init()
> to prevent memory leaks.
>
> Add the missing media_entity_cleanup() calls.

Missing empty line

> Signed-off-by: Biren Pandya <birenpandya@gmail.com>
> ---
>  drivers/media/platform/renesas/rcar-csi2.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 7305cc4a04cb..f9c818b0faf7 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -2631,6 +2631,7 @@ static int rcsi2_probe(struct platform_device *pdev)
>  	v4l2_subdev_cleanup(&priv->subdev);
>  error_pm_runtime:
>  	pm_runtime_disable(&pdev->dev);
> +	media_entity_cleanup(&priv->subdev.entity);
>  error_async:
>  	v4l2_async_nf_unregister(&priv->notifier);
>  	v4l2_async_nf_cleanup(&priv->notifier);
> @@ -2646,6 +2647,7 @@ static void rcsi2_remove(struct platform_device *pdev)
>  	v4l2_async_nf_cleanup(&priv->notifier);
>  	v4l2_async_unregister_subdev(&priv->subdev);
>  	v4l2_subdev_cleanup(&priv->subdev);
> +	media_entity_cleanup(&priv->subdev.entity);

It's hard to guess right now as media_entity_cleanup() is a nop,
but it would feel more safe to first cleanup subdev.entity and then
subdev itself

	media_entity_cleanup(&priv->subdev.entity);
 	v4l2_subdev_cleanup(&priv->subdev);

However, the probe() error path already does it in reverse, order,
so...

Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>


>
>  	pm_runtime_disable(&pdev->dev);
>  }
> --
> 2.50.1 (Apple Git-155)
>
>

  reply	other threads:[~2026-07-08 15:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 17:46 [PATCH v3 0/4] media: renesas: Fix missing media_entity_cleanup() Biren Pandya
2026-07-04 17:46 ` [PATCH v3 1/4] media: renesas: rcar-csi2: Add " Biren Pandya
2026-07-08 15:58   ` Jacopo Mondi [this message]
2026-07-04 17:46 ` [PATCH v3 2/4] media: renesas: csisp: " Biren Pandya
2026-07-08 15:54   ` Jacopo Mondi
2026-07-04 17:46 ` [PATCH v3 3/4] media: renesas: rcar-core: " Biren Pandya
2026-07-08 16:01   ` Jacopo Mondi
2026-07-04 17:46 ` [PATCH v3 4/4] media: renesas: rzg2l-core: " Biren Pandya
2026-07-08 16:02   ` Jacopo Mondi
  -- strict thread matches above, loose matches on Subject: below --
2026-06-22 17:33 [PATCH v3 0/4] media: renesas: Fix " Biren Pandya
2026-06-22 17:33 ` [PATCH v3 1/4] media: renesas: rcar-csi2: Add " Biren Pandya

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=ak5yyRucx7IKvcse@zed \
    --to=jacopo.mondi@ideasonboard.com \
    --cc=birenpandya@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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