ASoC: da7219: Fix an error handling path in da7219_register_dai_clks()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 22 Sep 2022 19:44:57 +0000 (21:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:56 +0000 (12:34 +0200)
commitf5f1f5ee5048cfa7bd07f496b33bd2cfc198a176
tree7fdfa32e32777f5785cf2c77ac03061c628501d4
parentf910aca076251dbd40ae962b779dfce077b98df5
ASoC: da7219: Fix an error handling path in da7219_register_dai_clks()

[ Upstream commit abb4e4349afe7eecdb0499582f1c777031e3a7c8 ]

If clk_hw_register() fails, the corresponding clk should not be
unregistered.

To handle errors from loops, clean up partial iterations before doing the
goto.  So add a clk_hw_unregister().
Then use a while (--i >= 0) loop in the unwind section.

Fixes: 78013a1cf297 ("ASoC: da7219: Fix clock handling around codec level probe")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/e4acceab57a0d9e477a8d5890a45c5309e553e7c.1663875789.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/da7219.c