PCI: qcom-ep: deinitialize endpoint on remove
Subsystems (5)
PATCH 1/1 PCI: qcom-ep: deinitialize endpoint on remove
qcom_pcie_ep_probe() initializes the DesignWare PCIe endpoint with dw_pcie_ep_init(). The probe failure paths call dw_pcie_ep_deinit() to release the corresponding endpoint resources, but the remove path does not perform the matching teardown after a successful probe.
As a result, resources initialized by the DesignWare endpoint core can remain allocated when the endpoint controller is removed.
Notify endpoint functions about EPC deinitialization and call dw_pcie_ep_deinit() before disabling the controller resources. Keep the existing early return when the link is already disabled since Qualcomm endpoint controllers depend on the host refclk for hardware cleanup.
This issue was found by manual code inspection.
--- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/dwc/pcie-qcom-ep.c +2 -0
@@ -944,6 +944,8 @@ static void qcom_pcie_ep_remove(struct platform_device *pdev)if (pcie_ep->link_status ==QCOM_PCIE_EP_LINK_DISABLED )return ; +pci_epc_deinit_notify (pcie_ep->pci.ep.epc); +dw_pcie_ep_deinit (&pcie_ep->pci.ep);qcom_pcie_disable_resources (pcie_ep); }
Signature · 1 line
2.43.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 13 lines
qcom_pcie_ep_probe()initializes the DesignWare PCIe endpoint withdw_pcie_ep_init(). The probe failure paths calldw_pcie_ep_deinit()to release the corresponding endpoint resources, but the remove path does not perform the matching teardown after a successful probe.As a result, resources initialized by the DesignWare endpoint core can remain allocated when the endpoint controller is removed.
Notify endpoint functions about EPC deinitialization and call
dw_pcie_ep_deinit()before disabling the controller resources. Keep the existing early return when the link is already disabled since Qualcomm endpoint controllers depend on the host refclk for hardware cleanup.
Quoted 5 lines
This issue was found by manual code inspection.
Fixes f55fee56a631 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver")Signed-off-by Guangshuo Li <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 1 line · Guangshuo Li
PCI: qcom-ep: deinitialize endpoint on remove
Applied, thanks!
[1/1] PCI: qcom-ep: deinitialize endpoint on remove
commit: 817c16e46609d60c22679d9145a39e28b1f6e164
Best regards,
Signature · 1 line
மணிவண்ணன் சதாசிவம்