ASoC: ux500: mop500: Fix some refcounted resources issues
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 12 May 2020 10:07:05 +0000 (12:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:44 +0000 (17:48 +0200)
commit038f34953d047b7e11aa6d3c0d7c721f41c725ea
tree5f55533f5f0b4fd3fbdc0e259fd4db124426503b
parent7bba0e9bc3261c7bb356abf476f81be05a5ae1ec
ASoC: ux500: mop500: Fix some refcounted resources issues

[ Upstream commit 4e8748fcaeec073e3ba794871ce86c545e4f961f ]

There are 2 issues here:
   - if one of the 'of_parse_phandle' fails, calling 'mop500_of_node_put()'
     is a no-op because the 'mop500_dai_links' structure has not been
     initialized yet, so the referenced are not decremented
   - The reference stored in 'mop500_dai_links[i].codecs' is refcounted
     only once in the probe and must be decremented only once.

Fixes: 39013bd60e79 ("ASoC: Ux500: Dispose of device nodes correctly")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20200512100705.246349-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/ux500/mop500.c