Skip to content

Commit a3c61bd

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 104a6e5 commit a3c61bd

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
@@ -1230,15 +1230,24 @@ int dw_pcie_resume_noirq(struct dw_pcie *pci)
12301230

12311231
ret = dw_pcie_start_link(pci);
12321232
if (ret)
1233-
return ret;
1233+
goto err_deinit;
12341234

12351235
ret = dw_pcie_wait_for_link(pci);
1236-
if (ret)
1237-
return ret;
1236+
if (ret == -ETIMEDOUT)
1237+
goto err_stop_link;
12381238

12391239
if (pci->pp.ops->post_init)
12401240
pci->pp.ops->post_init(&pci->pp);
12411241

1242+
return 0;
1243+
1244+
err_stop_link:
1245+
dw_pcie_stop_link(pci);
1246+
1247+
err_deinit:
1248+
if (pci->pp.ops->deinit)
1249+
pci->pp.ops->deinit(&pci->pp);
1250+
12421251
return ret;
12431252
}
12441253
EXPORT_SYMBOL_GPL(dw_pcie_resume_noirq);

0 commit comments

Comments
 (0)