]> asedeno.scripts.mit.edu Git - linux.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)
commit0b9c9ed6dd3b61b1d3ef1638786a7216006f67c5
treeb7d7b6fbc425ed891d940edf38825aa36cafa8c2
parent44662f90cda7ce0b65e77a7f1eefe45fb9053a4e
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