mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Zhang <18255117159@163.com>
To: "Felix Gu" <ustc.gu@gmail.com>,
	"Hans Zhang" <hans.zhang@cixtech.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: sky1: Fix missing cleanup of ECAM config on probe failure
Date: Tue, 24 Mar 2026 13:43:51 +0800	[thread overview]
Message-ID: <7ca0abb0-5202-4a43-a558-2b33d4a48b99@163.com> (raw)
In-Reply-To: <20260324-sky1-v1-1-6a00cb2776b6@gmail.com>



On 3/24/26 00:41, Felix Gu wrote:
> When devm_kzalloc() for reg_off fails, the code returns -ENOMEM
> without freeing pcie->cfg, which was allocated earlier by
> pci_ecam_create().
> 
> Add the missing pci_ecam_free() call to properly release the allocated
> ECAM configuration window on this error path.
> 
> Fixes: a0d9f2c08f45 ("PCI: sky1: Add PCIe host support for CIX Sky1")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Reviewed-by: Hans Zhang <18255117159@163.com>

> ---
>   drivers/pci/controller/cadence/pci-sky1.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/cadence/pci-sky1.c b/drivers/pci/controller/cadence/pci-sky1.c
> index d8c216dc120d..9853a9c82c0e 100644
> --- a/drivers/pci/controller/cadence/pci-sky1.c
> +++ b/drivers/pci/controller/cadence/pci-sky1.c
> @@ -176,8 +176,10 @@ static int sky1_pcie_probe(struct platform_device *pdev)
>   	cdns_pcie->is_rc = 1;
>   
>   	reg_off = devm_kzalloc(dev, sizeof(*reg_off), GFP_KERNEL);
> -	if (!reg_off)
> +	if (!reg_off) {
> +		pci_ecam_free(pcie->cfg);
>   		return -ENOMEM;
> +	}
>   
>   	reg_off->ip_reg_bank_offset = SKY1_IP_REG_BANK;
>   	reg_off->ip_cfg_ctrl_reg_offset = SKY1_IP_CFG_CTRL_REG_BANK;
> 
> ---
> base-commit: 785f0eb2f85decbe7c1ef9ae922931f0194ffc2e
> change-id: 20260323-sky1-890a90a72bc6
> 
> Best regards,


  reply	other threads:[~2026-03-24  5:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 16:41 Felix Gu
2026-03-24  5:43 ` Hans Zhang [this message]
2026-03-24  7:21 ` Manivannan Sadhasivam
2026-03-24 18:54   ` Markus Elfring

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=7ca0abb0-5202-4a43-a558-2b33d4a48b99@163.com \
    --to=18255117159@163.com \
    --cc=bhelgaas@google.com \
    --cc=hans.zhang@cixtech.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --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®