From 72e76b63d6ff6d1f96acccbfc6c118656f63e66a Mon Sep 17 00:00:00 2001 From: Felix Gu Date: Tue, 24 Mar 2026 00:41:28 +0800 Subject: PCI: sky1: Fix missing cleanup of ECAM config on probe failure 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 Signed-off-by: Manivannan Sadhasivam Reviewed-by: Hans Zhang <18255117159@163.com> Link: https://patch.msgid.link/20260324-sky1-v1-1-6a00cb2776b6@gmail.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; -- cgit v1.2.3 From 99d986686331ba3fd58dffb312e282d2bf81ee72 Mon Sep 17 00:00:00 2001 From: Hans Zhang <18255117159@163.com> Date: Sun, 15 Mar 2026 23:53:51 +0800 Subject: PCI: sky1: Use boolean true for is_rc field The is_rc field in struct cdns_pcie is of type bool. Replace the integer assignment (1) with the boolean literal true to improve code clarity and maintain consistency with the type definition. Signed-off-by: Hans Zhang <18255117159@163.com> Signed-off-by: Manivannan Sadhasivam Link: https://patch.msgid.link/20260315155351.127078-1-18255117159@163.com --- drivers/pci/controller/cadence/pci-sky1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/cadence/pci-sky1.c b/drivers/pci/controller/cadence/pci-sky1.c index 9853a9c82c0e..cd55c64e58a9 100644 --- a/drivers/pci/controller/cadence/pci-sky1.c +++ b/drivers/pci/controller/cadence/pci-sky1.c @@ -173,7 +173,7 @@ static int sky1_pcie_probe(struct platform_device *pdev) cdns_pcie->ops = &sky1_pcie_ops; cdns_pcie->reg_base = pcie->reg_base; cdns_pcie->msg_res = pcie->msg_res; - cdns_pcie->is_rc = 1; + cdns_pcie->is_rc = true; reg_off = devm_kzalloc(dev, sizeof(*reg_off), GFP_KERNEL); if (!reg_off) { -- cgit v1.2.3