From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: Biren Pandya <birenpandya@gmail.com>
Cc: linux-media@vger.kernel.org,
"Jacopo Mondi" <jacopo+renesas@jmondi.org>,
"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>
Subject: Re: [PATCH 2/5] media: i2c: max9286: Add missing media_entity_cleanup()
Date: Mon, 22 Jun 2026 10:29:49 +0200 [thread overview]
Message-ID: <ajjyVMy3yRu7n7KE@zed> (raw)
In-Reply-To: <20260619100126.22197-9-birenpandya@gmail.com>
Hi Biren
On Fri, Jun 19, 2026 at 03:31:29PM +0530, Biren Pandya wrote:
> The probe error paths and unregister function are missing calls to
> media_entity_cleanup(). Add them to prevent memory leaks if pads
> are dynamically allocated.
I think the last phrase can be dropped. media_entity_cleanup() is a
nop.
>
> Signed-off-by: Biren Pandya <birenpandya@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
> drivers/media/i2c/max9286.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
> index ac0712ce1e65..79eab9045e24 100644
> --- a/drivers/media/i2c/max9286.c
> +++ b/drivers/media/i2c/max9286.c
> @@ -1062,7 +1062,7 @@ static int max9286_v4l2_register(struct max9286_priv *priv)
> priv->sd.state_lock = priv->ctrls.lock;
> ret = v4l2_subdev_init_finalize(&priv->sd);
> if (ret)
> - goto err_async;
> + goto err_entity;
>
> ret = v4l2_async_register_subdev(&priv->sd);
> if (ret < 0) {
> @@ -1074,6 +1074,8 @@ static int max9286_v4l2_register(struct max9286_priv *priv)
>
> err_subdev:
> v4l2_subdev_cleanup(&priv->sd);
> +err_entity:
> + media_entity_cleanup(&priv->sd.entity);
> err_async:
> v4l2_ctrl_handler_free(&priv->ctrls);
> max9286_v4l2_notifier_unregister(priv);
> @@ -1084,6 +1086,7 @@ static int max9286_v4l2_register(struct max9286_priv *priv)
> static void max9286_v4l2_unregister(struct max9286_priv *priv)
> {
> v4l2_subdev_cleanup(&priv->sd);
> + media_entity_cleanup(&priv->sd.entity);
> v4l2_ctrl_handler_free(&priv->ctrls);
> v4l2_async_unregister_subdev(&priv->sd);
> max9286_v4l2_notifier_unregister(priv);
> --
> 2.50.1 (Apple Git-155)
>
>
next prev parent reply other threads:[~2026-06-22 8:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 10:01 [PATCH 0/5] media: i2c: Add missing media_entity_cleanup() calls Biren Pandya
2026-06-19 10:01 ` [PATCH 1/5] media: i2c: cx25840-core: Add missing media_entity_cleanup() Biren Pandya
2026-06-19 10:01 ` [PATCH 2/5] media: i2c: max9286: " Biren Pandya
2026-06-22 8:29 ` Jacopo Mondi [this message]
2026-06-19 10:01 ` [PATCH 3/5] media: i2c: msp3400-driver: " Biren Pandya
2026-06-22 8:34 ` Jacopo Mondi
2026-06-19 10:01 ` [PATCH 4/5] media: i2c: mt9v011: " Biren Pandya
2026-06-19 10:01 ` [PATCH 5/5] media: i2c: saa7115: " 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=ajjyVMy3yRu7n7KE@zed \
--to=jacopo.mondi@ideasonboard.com \
--cc=birenpandya@gmail.com \
--cc=jacopo+renesas@jmondi.org \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund+renesas@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