* [PATCH v2] PCI: brcmstb: Fix for missing of_node_put
@ 2025-01-22 22:29 Stanimir Varbanov
2025-01-31 11:52 ` Manivannan Sadhasivam
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stanimir Varbanov @ 2025-01-22 22:29 UTC (permalink / raw)
To: linux-rpi-kernel, linux-arm-kernel, linux-pci, linux-kernel
Cc: Florian Fainelli, Jim Quinlan, Nicolas Saenz Julienne,
Lorenzo Pieralisi, kw, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Stanimir Varbanov, stable
A call to of_parse_phandle() is incrementing the refcount, of_node_put
must be called when done the work on it. Add missing of_node_put() after
the check for msi_np == np and MSI initialization.
Cc: stable@vger.kernel.org # v5.10+
Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
---
v1 -> v2:
- Use of_node_put instead of cleanups (Florian).
- Sent the patch separately from PCIe 2712 series (Florian).
drivers/pci/controller/pcie-brcmstb.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 744fe1a4cf9c..d171ee61eab3 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1844,7 +1844,7 @@ static struct pci_ops brcm7425_pcie_ops = {
static int brcm_pcie_probe(struct platform_device *pdev)
{
- struct device_node *np = pdev->dev.of_node, *msi_np;
+ struct device_node *np = pdev->dev.of_node;
struct pci_host_bridge *bridge;
const struct pcie_cfg_data *data;
struct brcm_pcie *pcie;
@@ -1944,9 +1944,14 @@ static int brcm_pcie_probe(struct platform_device *pdev)
goto fail;
}
- msi_np = of_parse_phandle(pcie->np, "msi-parent", 0);
- if (pci_msi_enabled() && msi_np == pcie->np) {
- ret = brcm_pcie_enable_msi(pcie);
+ if (pci_msi_enabled()) {
+ struct device_node *msi_np = of_parse_phandle(pcie->np, "msi-parent", 0);
+
+ if (msi_np == pcie->np)
+ ret = brcm_pcie_enable_msi(pcie);
+
+ of_node_put(msi_np);
+
if (ret) {
dev_err(pcie->dev, "probe of internal MSI failed");
goto fail;
--
2.47.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: brcmstb: Fix for missing of_node_put
2025-01-22 22:29 [PATCH v2] PCI: brcmstb: Fix for missing of_node_put Stanimir Varbanov
@ 2025-01-31 11:52 ` Manivannan Sadhasivam
2025-02-03 18:38 ` Florian Fainelli
2025-02-20 16:14 ` Krzysztof Wilczyński
2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2025-01-31 11:52 UTC (permalink / raw)
To: Stanimir Varbanov
Cc: linux-rpi-kernel, linux-arm-kernel, linux-pci, linux-kernel,
Florian Fainelli, Jim Quinlan, Nicolas Saenz Julienne,
Lorenzo Pieralisi, kw, Rob Herring, Bjorn Helgaas, stable
On Thu, Jan 23, 2025 at 12:29:55AM +0200, Stanimir Varbanov wrote:
> A call to of_parse_phandle() is incrementing the refcount, of_node_put
> must be called when done the work on it. Add missing of_node_put() after
> the check for msi_np == np and MSI initialization.
>
> Cc: stable@vger.kernel.org # v5.10+
> Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
- Mani
> ---
> v1 -> v2:
> - Use of_node_put instead of cleanups (Florian).
> - Sent the patch separately from PCIe 2712 series (Florian).
>
> drivers/pci/controller/pcie-brcmstb.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 744fe1a4cf9c..d171ee61eab3 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -1844,7 +1844,7 @@ static struct pci_ops brcm7425_pcie_ops = {
>
> static int brcm_pcie_probe(struct platform_device *pdev)
> {
> - struct device_node *np = pdev->dev.of_node, *msi_np;
> + struct device_node *np = pdev->dev.of_node;
> struct pci_host_bridge *bridge;
> const struct pcie_cfg_data *data;
> struct brcm_pcie *pcie;
> @@ -1944,9 +1944,14 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> goto fail;
> }
>
> - msi_np = of_parse_phandle(pcie->np, "msi-parent", 0);
> - if (pci_msi_enabled() && msi_np == pcie->np) {
> - ret = brcm_pcie_enable_msi(pcie);
> + if (pci_msi_enabled()) {
> + struct device_node *msi_np = of_parse_phandle(pcie->np, "msi-parent", 0);
> +
> + if (msi_np == pcie->np)
> + ret = brcm_pcie_enable_msi(pcie);
> +
> + of_node_put(msi_np);
> +
> if (ret) {
> dev_err(pcie->dev, "probe of internal MSI failed");
> goto fail;
> --
> 2.47.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: brcmstb: Fix for missing of_node_put
2025-01-22 22:29 [PATCH v2] PCI: brcmstb: Fix for missing of_node_put Stanimir Varbanov
2025-01-31 11:52 ` Manivannan Sadhasivam
@ 2025-02-03 18:38 ` Florian Fainelli
2025-02-20 16:14 ` Krzysztof Wilczyński
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2025-02-03 18:38 UTC (permalink / raw)
To: Stanimir Varbanov, linux-rpi-kernel, linux-arm-kernel, linux-pci,
linux-kernel
Cc: Jim Quinlan, Nicolas Saenz Julienne, Lorenzo Pieralisi, kw,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, stable
On 1/22/25 14:29, Stanimir Varbanov wrote:
> A call to of_parse_phandle() is incrementing the refcount, of_node_put
> must be called when done the work on it. Add missing of_node_put() after
> the check for msi_np == np and MSI initialization.
>
> Cc: stable@vger.kernel.org # v5.10+
> Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: brcmstb: Fix for missing of_node_put
2025-01-22 22:29 [PATCH v2] PCI: brcmstb: Fix for missing of_node_put Stanimir Varbanov
2025-01-31 11:52 ` Manivannan Sadhasivam
2025-02-03 18:38 ` Florian Fainelli
@ 2025-02-20 16:14 ` Krzysztof Wilczyński
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Wilczyński @ 2025-02-20 16:14 UTC (permalink / raw)
To: Stanimir Varbanov
Cc: linux-rpi-kernel, linux-arm-kernel, linux-pci, linux-kernel,
Florian Fainelli, Jim Quinlan, Nicolas Saenz Julienne,
Lorenzo Pieralisi, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, stable
Hello,
> A call to of_parse_phandle() is incrementing the refcount, of_node_put
> must be called when done the work on it. Add missing of_node_put() after
> the check for msi_np == np and MSI initialization.
Applied to controller/brcmstb, thank you!
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-20 16:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-22 22:29 [PATCH v2] PCI: brcmstb: Fix for missing of_node_put Stanimir Varbanov
2025-01-31 11:52 ` Manivannan Sadhasivam
2025-02-03 18:38 ` Florian Fainelli
2025-02-20 16:14 ` Krzysztof Wilczyński
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).