]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: mt8173-rt5650: fix child-node lookup
authorJohan Hovold <johan@kernel.org>
Wed, 31 Jan 2018 05:59:21 +0000 (16:59 +1100)
committerMark Brown <broonie@kernel.org>
Wed, 7 Feb 2018 11:16:39 +0000 (11:16 +0000)
commit6d134d61ca74ffa2a7a4f4bed3fe55d8d69cd96a
tree76800ddda68a2603b466322066bdf8ea19ab6e2d
parentf9e9d4ede33f20ad238fc11db0232eaede684940
ASoC: mt8173-rt5650: fix child-node lookup

This driver used the wrong OF-helper when looking up the optional
capture-codec child node during probe. Instead of searching just
children of the sound node, a tree-wide depth-first search starting at
the unrelated platform node was done. Not only could this end up
matching an unrelated node or no node at all; the platform node could
also be prematurely freed since of_find_node_by_name() drops a reference
to its first argument. This particular pattern has been observed leading
to crashes after probe deferrals in other drivers.

Fix this by dropping the broken call to of_find_node_by_name() and
keeping only the second, correct lookup using of_get_child_by_name()
while taking care not to bail out if the optional node is missing.

Note that this also addresses two capture-codec node-reference leaks
(one for each of the original helper calls).

Compile tested only.

Fixes: 2b2364cd6658 ("ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/mt8173/mt8173-rt5650.c