[PATCH] pci: controller: brcmstb: Move of_node_put() out of 'if' in brcm_pcie_probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 3a87cb8f6a ("Fix refcount leak in brcm_pcie_probe()") adds
of_node_put() for of_parse_phandle() in fail path but not adds it
correctly in normal path. We should move the second of_node_put()
out of the 'if(pci_msi_enabled() && msi_np == pcie->np)'.

Fixes: 3a87cb8f6a ("Fix refcount leak in brcm_pcie_probe()")
Co-authored-by: Miaoqian Lin <linmq006@xxxxxxxxx>
Signed-off-by: Liang He <windhl@xxxxxxx>
---
 Patched file has been compiled test in next branch.

 drivers/pci/controller/pcie-brcmstb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 48a7148376d4..80e19d053e9f 100755
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1413,8 +1413,8 @@ static int brcm_pcie_probe(struct platform_device *pdev)
 			of_node_put(msi_np);
 			goto fail;
 		}
-		of_node_put(msi_np);
 	}
+	of_node_put(msi_np);
 
 	bridge->ops = pcie->type == BCM7425 ? &brcm_pcie_ops32 : &brcm_pcie_ops;
 	bridge->sysdata = pcie;
-- 
2.25.1




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux