linux/drivers/of
Julia Lawall 8363ccb917 of/irq: add missing of_node_put
for_each_matching_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
local idexpression n;
expression e;
identifier l;
@@

 for_each_matching_node(n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  goto l;
)
   ...
 }
...
l: ... when != n
// </smpl>

Besides the issue found by the semantic patch, this code also stores the
device_node value in a list, which requires an of_node_get, and then cleans
up the list on exit from the function, which requires an of_node_put.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-10-22 09:26:32 -05:00
..
unittest-data of/unittest: replace 'selftest' with 'unittest' 2015-03-25 00:53:29 -05:00
address.c PCI: of: Add 64-bit address recognition without LPAE support 2015-10-13 13:30:37 -05:00
base.c Devicetree changes for v4.2 2015-07-01 19:40:18 -07:00
device.c of: to support binding numa node to specified device in devicetree 2015-09-17 14:51:55 -05:00
dynamic.c of/dynamic: Fix test for PPC_PSERIES 2015-06-05 10:39:28 +09:00
fdt.c of/fdt: fix aliases with baudrate in earlycon 2015-10-13 13:31:26 -05:00
fdt_address.c of/fdt: add FDT address translation support 2014-05-20 15:19:25 -05:00
irq.c of/irq: add missing of_node_put 2015-10-22 09:26:32 -05:00
Kconfig of: add HAS_IOMEM depends to OF_ADDRESS 2015-07-27 08:21:04 -05:00
Makefile of: clean-up unnecessary libfdt include paths 2015-06-04 20:16:47 -05:00
of_mdio.c of_mdio: fix MDIO phy device refcounting 2015-09-24 23:04:52 -07:00
of_mtd.c of_mtd: Add helpers to get ECC strength and ECC step size 2014-03-10 22:42:28 -07:00
of_net.c of_net: factor out repetitive code from of_get_mac_address() 2015-03-29 08:56:17 +01:00
of_pci.c PCI: of: Ignore resources with failed translation 2015-10-13 13:30:42 -05:00
of_pci_irq.c of_pci_irq: Silence bogus "of_irq_parse_pci() failed ..." messages. 2015-09-17 14:46:11 -05:00
of_private.h of: Refactor __of_node_alloc() into __of_node_dup() 2014-11-24 22:24:41 +00:00
of_reserved_mem.c of: Check for overlap in reserved memory regions 2015-09-17 14:52:06 -05:00
overlay.c of/overlay: Grammar s/an negative/a negative/ 2015-05-28 13:00:25 -05:00
pdt.c of: Eliminate of_allnodes list 2014-11-04 13:29:38 +00:00
platform.c DeviceTree updates for 4.3: 2015-09-01 19:37:56 -07:00
resolver.c of/resolver: Switch to new local fixups format. 2014-11-24 22:24:50 +00:00
unittest.c of/unittest: add missing of_node_put 2015-10-22 09:26:28 -05:00