mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Wentao Liang <vulab@iscas.ac.cn>, cassel@kernel.org
Cc: gregory.clement@bootlin.com, hansg@kernel.org,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	tj@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ata: libahci_platform: Fix device reference leak in ahci_platform_get_resources()
Date: Wed, 16 Sep 2026 09:11:23 +0700	[thread overview]
Message-ID: <9fbef6c3-b56b-486a-848e-5926bf5e67dc@kernel.org> (raw)
In-Reply-To: <20260915065933.1733061-1-vulab@iscas.ac.cn>

On 2026/09/15 13:59, Wentao Liang wrote:
> of_find_device_by_node() takes a reference on the port platform device,
> which is only used to look up its port regulator and is never released,
> neither on success nor on the error paths. Drop the reference with
> put_device() once the regulator has been obtained, which covers both the
> success and error paths.
> 
> Fixes: c7d7ddee7e24 ("ata: libahci: Allow using multiple regulators")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/ata/libahci_platform.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index 6e072d681341..14a47e0bddd4 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -624,6 +624,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
>  			if (port_dev) {
>  				rc = ahci_platform_get_regulator(hpriv, port,
>  								&port_dev->dev);
> +				put_device(&port_dev->dev);

Looks good. But while at it, please remove the blank line between the call to
of_find_device_by_node() and the if.

With that done,

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>


>  				if (rc == -EPROBE_DEFER)
>  					goto err_out;
>  			}


-- 
Damien Le Moal
Western Digital Research

      parent reply	other threads:[~2026-09-16  2:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  6:59 Wentao Liang
2026-09-15  9:22 ` Niklas Cassel
2026-09-16  5:29   ` Niklas Cassel
2026-09-16  2:11 ` Damien Le Moal [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=9fbef6c3-b56b-486a-848e-5926bf5e67dc@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cassel@kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=hansg@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.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®