ASoC: ti: omap-mcbsp: Fix an error handling path in 'asoc_mcbsp_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 12 May 2020 13:43:25 +0000 (15:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:44 +0000 (17:48 +0200)
commitb7fcc8e32dc514ecbe0ec259cbe9800d53c0c0ab
tree7993e4c10035c4cce09123e51d0924d614bfb9f9
parent038f34953d047b7e11aa6d3c0d7c721f41c725ea
ASoC: ti: omap-mcbsp: Fix an error handling path in 'asoc_mcbsp_probe()'

[ Upstream commit 03990fd58d2b7c8f7d53e514ba9b8749fac260f9 ]

If an error occurs after the call to 'omap_mcbsp_init()', the reference to
'mcbsp->fclk' must be decremented, as already done in the remove function.

This can be achieved easily by using the devm_ variant of 'clk_get()'
when the reference is taken in 'omap_mcbsp_init()'

This fixes the leak in the probe and has the side effect to simplify both
the error handling path of 'omap_mcbsp_init()' and the remove function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Peter Ujfalusi <peter.ujflausi@ti.com>
Link: https://lore.kernel.org/r/20200512134325.252073-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/ti/omap-mcbsp.c