linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] PCI: dwc: pci-dra7xx: fix a leaked reference by adding missing of_node_put
@ 2019-02-27  4:40 Wen Yang
  2019-02-27  4:40 ` [PATCH 2/8] PCI: uniphier: " Wen Yang
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Wen Yang @ 2019-02-27  4:40 UTC (permalink / raw)
  To: benh
  Cc: paulus, mpe, tyreld, bhelgaas, linuxppc-dev, linux-pci,
	linux-kernel, ryder.lee, lorenzo.pieralisi, matthias.bgg,
	linux-mediatek, linux-arm-kernel, rjui, sbranden,
	bcm-kernel-feedback-list, thomas.petazzoni, shawn.lin, heiko,
	linux-rockchip, minghuan.Lian, mingkai.hu, roy.zang,
	hayashi.kunihiko, yamada.masahiro, kishon, linux-omap, wang.yi59,
	Wen Yang

The call to of_get_next_child returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
irq_domain_add_linear also calls of_node_get to increase refcount,
so irq_domain will not be affected when it is released.

Detected by coccinelle with the following warnings:
./drivers/pci/controller/dwc/pci-dra7xx.c:252:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
./drivers/pci/controller/dwc/pci-dra7xx.c:255:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-omap@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/pci/controller/dwc/pci-dra7xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index ae84a69..627c91d 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -247,6 +247,7 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp)
 
 	dra7xx->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
 						   &intx_domain_ops, pp);
+	of_node_put(pcie_intc_node);
 	if (!dra7xx->irq_domain) {
 		dev_err(dev, "Failed to get a INTx IRQ domain\n");
 		return -ENODEV;
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-01 10:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-27  4:40 [PATCH 1/8] PCI: dwc: pci-dra7xx: fix a leaked reference by adding missing of_node_put Wen Yang
2019-02-27  4:40 ` [PATCH 2/8] PCI: uniphier: " Wen Yang
2019-02-27  4:40 ` [PATCH 3/8] PCI: dwc: layerscape: " Wen Yang
2019-02-27  4:40 ` [PATCH 4/8] PCI: rockchip: " Wen Yang
2019-02-27  4:40 ` [PATCH 5/8] PCI: aardvark: " Wen Yang
2019-02-27  4:40 ` [PATCH 6/8] PCI: iproc: " Wen Yang
2019-02-27  4:40 ` [PATCH 7/8] PCI: mediatek: " Wen Yang
2019-03-01  1:59   ` Honghui Zhang
2019-02-27  4:40 ` [PATCH 8/8] PCI: rpadlpar: " Wen Yang
2019-04-01 10:03 ` [PATCH 1/8] PCI: dwc: pci-dra7xx: " Lorenzo Pieralisi

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).