Skip to content

Commit 3522f27

Browse files
outman119gregkh
authored andcommitted
PCI: sky1: Fix missing cleanup of ECAM config on probe failure
[ Upstream commit 72e76b6 ] 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: a0d9f2c ("PCI: sky1: Add PCIe host support for CIX Sky1") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Hans Zhang <18255117159@163.com> Link: https://patch.msgid.link/20260324-sky1-v1-1-6a00cb2776b6@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c976e19 commit 3522f27

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/pci/controller/cadence/pci-sky1.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ static int sky1_pcie_probe(struct platform_device *pdev)
176176
cdns_pcie->is_rc = 1;
177177

178178
reg_off = devm_kzalloc(dev, sizeof(*reg_off), GFP_KERNEL);
179-
if (!reg_off)
179+
if (!reg_off) {
180+
pci_ecam_free(pcie->cfg);
180181
return -ENOMEM;
182+
}
181183

182184
reg_off->ip_reg_bank_offset = SKY1_IP_REG_BANK;
183185
reg_off->ip_cfg_ctrl_reg_offset = SKY1_IP_CFG_CTRL_REG_BANK;

0 commit comments

Comments
 (0)