mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Haotian Zhang <vulab@iscas.ac.cn>, <sean@mess.org>, <mchehab@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: rc: st_rc: fix reset control resource leak
Date: Fri, 31 Oct 2025 10:49:43 +0100	[thread overview]
Message-ID: <acbf6f70-8ab8-47b2-b31c-5c01f4d5bb02@foss.st.com> (raw)
In-Reply-To: <20251031060332.1470-1-vulab@iscas.ac.cn>



On 10/31/25 07:03, Haotian Zhang wrote:
> The driver calls reset_control_get_optional_exclusive() but never calls
> reset_control_put() in error paths or in the remove function. This causes
> a resource leak when probe fails after successfully acquiring the reset
> control, or when the driver is unloaded.
> 
> Switch to devm_reset_control_get_optional_exclusive() to automatically
> manage the reset control resource.
> 
> Fixes: a4b80242d046 ("media: st-rc: explicitly request exclusive reset control")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---
>  drivers/media/rc/st_rc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
> index 6539fa0a6e79..6b70bac5f45d 100644
> --- a/drivers/media/rc/st_rc.c
> +++ b/drivers/media/rc/st_rc.c
> @@ -284,7 +284,7 @@ static int st_rc_probe(struct platform_device *pdev)
>  	else
>  		rc_dev->rx_base = rc_dev->base;
>  
> -	rc_dev->rstc = reset_control_get_optional_exclusive(dev, NULL);
> +	rc_dev->rstc = devm_reset_control_get_optional_exclusive(dev, NULL);
>  	if (IS_ERR(rc_dev->rstc)) {
>  		ret = PTR_ERR(rc_dev->rstc);
>  		goto err;


Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

      reply	other threads:[~2025-10-31  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31  6:03 Haotian Zhang
2025-10-31  9:49 ` Patrice CHOTARD [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=acbf6f70-8ab8-47b2-b31c-5c01f4d5bb02@foss.st.com \
    --to=patrice.chotard@foss.st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sean@mess.org \
    --cc=vulab@iscas.ac.cn \
    /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®