]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
PCI: endpoint: Destroy the EPC device in devm_pci_epc_destroy()
authorZijun Hu <quic_zijuhu@quicinc.com>
Tue, 10 Dec 2024 14:00:18 +0000 (22:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:08 +0000 (12:50 +0100)
commita61cd3df84b323df7e98f2a478801c452d85e3a6
treef1845a00cdd962b02c0c21d3dba2de9b5e5d596e
parent55c326068f6b7f1f6552f64a3cd7efd0200be33f
PCI: endpoint: Destroy the EPC device in devm_pci_epc_destroy()

[ Upstream commit d4929755e4d02bd3de3ae5569dab69cb9502c54f ]

The devm_pci_epc_destroy() comment says destroys the EPC device, but it
does not actually do that since devres_destroy() does not call
devm_pci_epc_release(), and it also can not fully undo what the API
devm_pci_epc_create() does, so it is faulty.

Fortunately, the faulty API has not been used by current kernel tree.  Use
devres_release() instead of devres_destroy() so the EPC device will be
released.

Link: https://lore.kernel.org/r/20241210-pci-epc-core_fix-v3-1-4d86dd573e4b@quicinc.com
Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP controller and EP functions")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/endpoint/pci-epc-core.c