linux/drivers/of
Tony Lindgren c0a480d1ac device property: Fix usecount for of_graph_get_port_parent()
Fix inconsistent use of of_graph_get_port_parent() where
asoc_simple_card_parse_graph_dai() does of_node_get() before
calling it while other callers do not. We can fix this by
not trashing the node passed to of_graph_get_port_parent().

Let's also make sure the callers have correct refcounts and remove
related incorrect of_node_put() calls for of_for_each_phandle
as that's done by of_phandle_iterator_next() except when
we break out of the loop early.

Let's fix both issues with a single patch to avoid kobject
refcounts getting messed up more if two patches are merged
separately.

Otherwise strange issues can happen caused by memory corruption
caused by too many kobject_del() calls such as:

BUG: sleeping function called from invalid context at
kernel/locking/mutex.c:747
...
(___might_sleep)
(__mutex_lock)
(mutex_lock_nested)
(kernfs_remove)
(kobject_del)
(kobject_put)
(of_get_next_parent)
(of_graph_get_port_parent)
(asoc_simple_card_parse_graph_dai [snd_soc_simple_card_utils])
(asoc_graph_card_probe [snd_soc_audio_graph_card])

Fixes: 0ef472a973 ("of_graph: add of_graph_get_port_parent()")
Fixes: 2692c1c63c ("ASoC: add audio-graph-card support")
Fixes: 1689333f83 ("ASoC: simple-card-utils: add asoc_simple_card_parse_graph_dai()")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Tested-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-01 15:15:42 +01:00
..
unittest-data vsprintf: Add %p extension "%pOF" for device tree 2017-06-27 12:36:40 -05:00
address.c of: address.c header comment typo 2017-06-22 11:15:00 -05:00
base.c Merge branch 'dt/property-move' into dt/next 2017-07-05 08:31:52 -05:00
device.c iommu/of: Ignore all errors except EPROBE_DEFER 2017-05-30 11:31:32 +02:00
dynamic.c of: make __of_attach_node() static 2017-06-22 11:16:35 -05:00
fdt.c DeviceTree for 4.13: 2017-07-07 10:37:54 -07:00
fdt_address.c of: use pr_fmt prefix for all console printing 2016-07-18 16:57:42 -05:00
irq.c of: irq: use of_irq_get() in of_irq_to_resource() 2017-05-16 09:11:22 -05:00
Kconfig mtd: Kill the OF_MTD Kconfig option 2016-09-23 09:35:16 +02:00
Makefile of: Move OF property and graph API from base.c to property.c 2017-06-01 08:50:45 -05:00
of_mdio.c of_mdio: move of_mdio_parse_addr to header file 2017-06-13 14:00:16 -04:00
of_net.c of_net: factor out repetitive code from of_get_mac_address() 2015-03-29 08:56:17 +01:00
of_numa.c of: fix "/cpus" reference leak in of_numa_parse_cpu_nodes() 2017-04-18 11:04:12 -05:00
of_pci.c of/pci: Remove unused MSI controller helpers 2017-03-14 15:10:11 -05:00
of_pci_irq.c OF/PCI: Update of_irq_parse_and_map_pci() comment 2017-07-02 16:14:28 -05:00
of_private.h of: find_node_by_full_name rewrite to compare each level 2017-06-22 12:38:29 -05:00
of_reserved_mem.c Partially Revert "of: fix sparse warnings in fdt, irq, reserved mem, and resolver code" 2017-05-11 10:26:22 -05:00
overlay.c of: detect invalid phandle in overlay 2017-06-22 11:19:09 -05:00
pdt.c of: Eliminate of_allnodes list 2014-11-04 13:29:38 +00:00
platform.c DeviceTree for 4.13: 2017-07-07 10:37:54 -07:00
property.c device property: Fix usecount for of_graph_get_port_parent() 2017-08-01 15:15:42 +01:00
resolver.c of: find_node_by_full_name rewrite to compare each level 2017-06-22 12:38:29 -05:00
unittest.c vsprintf: Add %p extension "%pOF" for device tree 2017-06-27 12:36:40 -05:00