[PATCH 3/8] PCI: dwc: layerscape: fix a leaked reference by adding missing of_node_put
Wen Yang
wen.yang99 at zte.com.cn
Wed Feb 27 15:40:38 AEDT 2019
The call to of_parse_phandle returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/pci/controller/dwc/pci-layerscape.c:204:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 198, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99 at zte.com.cn>
Cc: Minghuan Lian <minghuan.Lian at nxp.com>
Cc: Mingkai Hu <mingkai.hu at nxp.com>
Cc: Roy Zang <roy.zang at nxp.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
Cc: Bjorn Helgaas <bhelgaas at google.com>
Cc: linuxppc-dev at lists.ozlabs.org
Cc: linux-pci at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
---
drivers/pci/controller/dwc/pci-layerscape.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c
index ce45bde2..3a5fa26 100644
--- a/drivers/pci/controller/dwc/pci-layerscape.c
+++ b/drivers/pci/controller/dwc/pci-layerscape.c
@@ -201,6 +201,7 @@ static int ls_pcie_msi_host_init(struct pcie_port *pp)
return -EINVAL;
}
+ of_node_put(msi_node);
return 0;
}
--
2.9.5
More information about the Linuxppc-dev
mailing list