mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Biren Pandya <birenpandya@gmail.com>
Cc: "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>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] media: i2c: rdacm21: Fix missing media_entity_cleanup()
Date: Wed, 8 Jul 2026 18:04:01 +0300	[thread overview]
Message-ID: <ak5m4UZKfO6dvz2L@kekkonen.localdomain> (raw)
In-Reply-To: <20260704201627.82584-2-birenpandya@gmail.com>

Hi Biren,

Thanks for the patches.

On Sun, Jul 05, 2026 at 01:46:28AM +0530, Biren Pandya wrote:
> The driver misses calling media_entity_cleanup() on the probe error path
> and during remove, leaking resources if probe fails after entity
> initialization or when the driver is unloaded.
> 
> Fix this by adding media_entity_cleanup() to the rdacm21_probe() error
> handling path and to rdacm21_remove().
> 
> Fixes: a59f853b3b4b ("media: i2c: Add driver for RDACM21 camera module")
> Signed-off-by: Biren Pandya <birenpandya@gmail.com>
> ---
> Changes in v2:
> - Fixed a bug in v1's probe error handling where media_entity_cleanup() could be called on an uninitialized entity.
> - Added Signed-off-by tag which was missing in v1.
> 
>  drivers/media/i2c/rdacm21.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c
> index bcab462708c70..ece8a410e7ced 100644
> --- a/drivers/media/i2c/rdacm21.c
> +++ b/drivers/media/i2c/rdacm21.c
> @@ -588,10 +588,12 @@ static int rdacm21_probe(struct i2c_client *client)
>  
>  	ret = v4l2_async_register_subdev(&dev->sd);
>  	if (ret)
> -		goto error_free_ctrls;
> +		goto error_entity_cleanup;
>  
>  	return 0;
>  
> +error_entity_cleanup:
> +	media_entity_cleanup(&dev->sd.entity);

A newline would be nice here.

Somehow the patch can't be found in linuxtv.org...

>  error_free_ctrls:
>  	v4l2_ctrl_handler_free(&dev->ctrls);
>  error:
> @@ -606,6 +608,7 @@ static void rdacm21_remove(struct i2c_client *client)
>  
>  	v4l2_async_unregister_subdev(&dev->sd);
>  	v4l2_ctrl_handler_free(&dev->ctrls);
> +	media_entity_cleanup(&dev->sd.entity);
>  	i2c_unregister_device(dev->isp);
>  }
>  

-- 
Regards,

Sakari Ailus

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 20:16 Biren Pandya
2026-07-08 15:04 ` Sakari Ailus [this message]
2026-07-08 15:29 ` [PATCH v3] " Biren Pandya
2026-07-08 15:44   ` Biren Pandya
2026-07-08 15:44     ` [PATCH v4] " Biren Pandya
  -- strict thread matches above, loose matches on Subject: below --
2026-06-21  6:07 [PATCH v2] " Biren Pandya
2026-06-22  7:58 ` Jacopo Mondi

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=ak5m4UZKfO6dvz2L@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=birenpandya@gmail.com \
    --cc=jacopo+renesas@jmondi.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®