Thread (3 messages) flat view 3 messages, 2 authors, 2016-08-25

Re: [PATCH 1/1] pci: host: pci-layerscape: add missing of_node_put after calling of_parse_phandle

From: Bjorn Helgaas <helgaas@kernel.org>
Date: 2016-08-23 21:19:22
Also in: linux-pci

Hi Peter,

On Fri, Aug 12, 2016 at 09:34:41AM +0800, Peter Chen wrote:
quoted hunk ↗ jump to hunk
of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Cc: Minghuan Lian <redacted>
Cc: Mingkai Hu <redacted>
Cc: Roy Zang <redacted>
Signed-off-by: Peter Chen <redacted>
---
 drivers/pci/host/pci-layerscape.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c
index 114ba81..573b996 100644
--- a/drivers/pci/host/pci-layerscape.c
+++ b/drivers/pci/host/pci-layerscape.c
@@ -173,6 +173,8 @@ static int ls_pcie_msi_host_init(struct pcie_port *pp,
 		return -EINVAL;
 	}
 
+	of_node_put(msi_node);
+
Can you please look for and fix similar errors in other drivers in
drivers/pci/host/*?

For example:

  advk_pcie_probe() and iproc_pcie_msi_enable() call
  of_parse_phandle() but don't call of_node_put() in failure paths.

  dra7xx_pcie_init_irq_domain(), nwl_pcie_init_irq_domain(), and
  xilinx_pcie_init_irq_domain() call of_get_next_child() but don't
  call of_node_put() in failure paths.

  ks_pcie_get_irq_controller_info() calls of_find_node_by_name().

I think there may be others, e.g., the pci_host_bridge_msi_domain()
path calls of_parse_phandle(), but I'm not sure of_node_put() is
called on failure paths.

When we find bugs like this, it's nice to fix one occurrence, but it's
really great if we can squash similar bugs nearby so the bug isn't
copied into new drivers.
 	return 0;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help