]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: simple-card: Fix of-node refcount unbalance in DAI-link parser
authorTakashi Iwai <tiwai@suse.de>
Tue, 19 Feb 2019 15:46:49 +0000 (16:46 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 20 Feb 2019 12:12:37 +0000 (12:12 +0000)
commit7d06166ef6bd9fb4be7ad75d16d6b3199551d854
treeb7d7b6fbc425ed891d940edf38825aa36cafa8c2
parent9574c8d68e71d9255136b0ed9d474f76913b61dd
ASoC: simple-card: Fix of-node refcount unbalance in DAI-link parser

The function simple_for_each_link() has a few missing places that
forgot unrefereing of-nodes after the use.  The main do-while loop
may abort when loop=0, and this leaves the node object still
referenced.  A similar leak is found in the error handling of NULL
codec that aborts the loop as well.  Last but not least, the inner
for_each_child_of_node() loop may abort in the middle, and this leaks
the refcount of the iterator node.

This patch addresses these missing refcount issues.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/simple-card.c