Skip to content

Commit 47f6075

Browse files
Mani-Sadhasivamgregkh
authored andcommitted
PCI: dwc: Perform cleanup in the error path of dw_pcie_resume_noirq()
[ Upstream commit edb5ca3 ] If the dw_pcie_resume_noirq() API fails, it just returns the errno without doing cleanup in the error path, leading to resource leak. So perform cleanup in the error path. Fixes: 4774faf ("PCI: dwc: Implement generic suspend/resume functionality") Reported-by: Senchuan Zhang <zhangsenchuan@eswincomputing.com> Closes: https://lore.kernel.org/linux-pci/78296255.3869.19c8eb694d6.Coremail.zhangsenchuan@eswincomputing.com Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://patch.msgid.link/20260226133951.296743-1-mani@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4a10f08 commit 47f6075

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

drivers/pci/controller/dwc/pcie-designware-host.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -984,15 +984,24 @@ int dw_pcie_resume_noirq(struct dw_pcie *pci)
984984

985985
ret = dw_pcie_start_link(pci);
986986
if (ret)
987-
return ret;
987+
goto err_deinit;
988988

989989
ret = dw_pcie_wait_for_link(pci);
990-
if (ret)
991-
return ret;
990+
if (ret == -ETIMEDOUT)
991+
goto err_stop_link;
992992

993993
if (pci->pp.ops->post_init)
994994
pci->pp.ops->post_init(&pci->pp);
995995

996+
return 0;
997+
998+
err_stop_link:
999+
dw_pcie_stop_link(pci);
1000+
1001+
err_deinit:
1002+
if (pci->pp.ops->deinit)
1003+
pci->pp.ops->deinit(&pci->pp);
1004+
9961005
return ret;
9971006
}
9981007
EXPORT_SYMBOL_GPL(dw_pcie_resume_noirq);

0 commit comments

Comments
 (0)