mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe()
A call to of_parse_phandle() is incrementing the refcount, and as such,
the of_node_put() must be called when the reference is no longer needed.
Thus, refactor the existing code and add a missing of_node_put() call
following the check to ensure that "msi_np" matches "pcie->np" and after
MSI initialization, but only if the MSI support is enabled system-wide.
Cc: stable@vger.kernel.org # v5.10+
Fixes: 40ca1bf580 ("PCI: brcmstb: Add MSI support")
Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20250122222955.1752778-1-svarbanov@suse.de
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
This commit is contained in:
parent
2014c95afe
commit
2df181e1ae
|
|
@ -1784,7 +1784,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;
|
||||
|
|
@ -1888,9 +1888,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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user