mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Felix Gu <ustc.gu@gmail.com>
Cc: Bartosz Golaszewski <brgl@kernel.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Markus Elfring <Markus.Elfring@web.de>
Subject: Re: [PATCH] PCI/pwrctrl: generic: Fix leak on clock error path
Date: Mon, 2 Nov 2026 14:18:34 -0600	[thread overview]
Message-ID: <20261102201834.GA974502@bhelgaas> (raw)
In-Reply-To: <20261031-pwrctrl-v1-1-405af11c5662@gmail.com>

[+cc Markus]

On Sat, Oct 31, 2026 at 01:49:08AM +0800, Felix Gu wrote:
> The devm release action for the slot supplies is registered after
> devm_clk_get_optional().  If clock acquisition fails, probe returns
> immediately, so the resources eallocated by of_regulator_bulk_get_all()
> is never freed.
> 
> Register the devm action right after of_regulator_bulk_get_all()
> succeeds, so the resources are released on any subsequent probe failure.
> 
> Fixes: 9cb64f61ec7a9 ("PCI/pwrctrl: Add PCIe M.2 connector support")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Applied to pci/pwrctrl for v7.5, thanks!

Fixed the eallocated->allocated and is->are commit log typos.

> ---
>  drivers/pci/pwrctrl/generic.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/pwrctrl/generic.c b/drivers/pci/pwrctrl/generic.c
> index 4b6cbbb52248..85d568b381e2 100644
> --- a/drivers/pci/pwrctrl/generic.c
> +++ b/drivers/pci/pwrctrl/generic.c
> @@ -92,6 +92,10 @@ static int slot_pwrctrl_probe(struct platform_device *pdev)
>  
>  	slot->num_supplies = ret;
>  
> +	ret = devm_add_action_or_reset(dev, devm_slot_pwrctrl_release, slot);
> +	if (ret)
> +		return ret;
> +
>  	slot->clk = devm_clk_get_optional(dev, NULL);
>  	if (IS_ERR(slot->clk))
>  		return dev_err_probe(dev, PTR_ERR(slot->clk),
> @@ -101,10 +105,6 @@ static int slot_pwrctrl_probe(struct platform_device *pdev)
>  	slot->pwrctrl.power_on = slot_pwrctrl_power_on;
>  	slot->pwrctrl.power_off = slot_pwrctrl_power_off;
>  
> -	ret = devm_add_action_or_reset(dev, devm_slot_pwrctrl_release, slot);
> -	if (ret)
> -		return ret;
> -
>  	pci_pwrctrl_init(&slot->pwrctrl, dev);
>  
>  	ret = devm_pci_pwrctrl_device_set_ready(dev, &slot->pwrctrl);
> 
> ---
> base-commit: a39c950806213f6861d00f90729acaaa21f2d95a
> change-id: 20261030-pwrctrl-6a85275b0c97
> 
> Best regards,
> --  
> Felix Gu <ustc.gu@gmail.com>
> 

      parent reply	other threads:[~2026-11-02 20:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 17:49 Felix Gu
2026-10-30 19:10 ` Markus Elfring
2026-11-02 13:33 ` Bartosz Golaszewski
2026-11-02 20:18 ` Bjorn Helgaas [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=20261102201834.GA974502@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=bhelgaas@google.com \
    --cc=brgl@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=ustc.gu@gmail.com \
    /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®