Re: [PATCH v2 2/2] PCI: qcom: Implement shutdown() callback
| Newsgroups | org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The qcom_pcie_shutdown() callback unconditionally dereferences the `pcie` pointer, which will cause a kernel panic for firmware-managed devices. - [Medium] Calling asynchronous pm_runtime_put() immediately before pm_runtime_disable() risks cancelling pending suspend operations and violates Power Management guidelines. -- --- Patch [2]: [PATCH v2 2/2] PCI: qcom: Implement shutdown() callback --- commit 321e5283c22739b1af3a513ad41fac675e68553f Author: Manivannan Sadhasivam <[email protected]> PCI: qcom: Implement shutdown() callback This commit implements a shutdown callback for the Qualcomm PCIe controller. It reuses dw_pcie_suspend_noirq() to safely bring down the link and transition to D3cold during system shutdown or reboot. > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index d8eb52857f69c..f6a0cbb6a49e8 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -2156,6 +2156,15 @@ static int qcom_pcie_probe(struct platform_device *pdev) > return ret; > } > > +static void qcom_pcie_shutdown(struct platform_device *pdev) > +{ > + struct qcom_pcie *pcie = platform_get_drvdata(pdev); > + > + dw_pcie_suspend_noirq(pcie->pci); [Severity: High] Can pcie be NULL here? In qcom_pcie_probe(), if the device is firmware_managed, the probe returns 0 early without allocating the pcie structure or calling platform_set_drvdata(). Will this result in a NULL pointer dereference during shutdown on those platforms? > + pm_runtime_put(&pdev->dev); > + pm_runtime_disable(&pdev->dev); [Severity: Medium] Does using the asynchronous pm_runtime_put() here risk cancelling the pending suspend operation when pm_runtime_disable() is immediately called? Should this use pm_runtime_put_sync() instead to ensure the suspend completes before runtime PM is disabled? > +} > -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2