diff mbox series

PCI: endpoint: Fix API devm_pci_epc_destroy() can not destroy the EPC device

Message ID 20241020-pci-epc-core_fix-v1-1-3899705e3537@quicinc.com (mailing list archive)
State New
Headers show
Series PCI: endpoint: Fix API devm_pci_epc_destroy() can not destroy the EPC device | expand

Commit Message

Zijun Hu Oct. 20, 2024, 9:56 a.m. UTC
From: Zijun Hu <quic_zijuhu@quicinc.com>

For devm_pci_epc_destroy(), its comment says it needs to destroy the EPC
device, but it does not do that actually, so it can not fully undo what
the API devm_pci_epc_create() does, that is wrong, fixed by using
devres_release() instead of devres_destroy() within the API.

Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP controller and EP functions")
Cc: stable@vger.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
 drivers/pci/endpoint/pci-epc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 715ca9dd687f89ddaac8ec8ccb3b5e5a30311a99
change-id: 20241020-pci-epc-core_fix-a92512fa9d19

Best regards,
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 17f007109255..71b6d100056e 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -857,7 +857,7 @@  void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc)
 {
 	int r;
 
-	r = devres_destroy(dev, devm_pci_epc_release, devm_pci_epc_match,
+	r = devres_release(dev, devm_pci_epc_release, devm_pci_epc_match,
 			   epc);
 	dev_WARN_ONCE(dev, r, "couldn't find PCI EPC resource\n");
 }