]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: wm2000: fix missing clk_disable_unprepare() on error in wm2000_anc_transition()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 14 May 2022 09:10:53 +0000 (17:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:59:23 +0000 (16:59 +0200)
[ Upstream commit be2af740e2a9c7134f2d8ab4f104006e110b13de ]

Fix the missing clk_disable_unprepare() before return
from wm2000_anc_transition() in the error handling case.

Fixes: 514cfd6dd725 ("ASoC: wm2000: Integrate with clock API")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220514091053.686416-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/wm2000.c

index c5ae07234a0060697c4c161b7fba16a8347c2a06..cad39f63b76356db2a4dccb1f3821bf58ecda5e6 100644 (file)
@@ -545,7 +545,7 @@ static int wm2000_anc_transition(struct wm2000_priv *wm2000,
 {
        struct i2c_client *i2c = wm2000->i2c;
        int i, j;
-       int ret;
+       int ret = 0;
 
        if (wm2000->anc_mode == mode)
                return 0;
@@ -575,13 +575,13 @@ static int wm2000_anc_transition(struct wm2000_priv *wm2000,
                ret = anc_transitions[i].step[j](i2c,
                                                 anc_transitions[i].analogue);
                if (ret != 0)
-                       return ret;
+                       break;
        }
 
        if (anc_transitions[i].dest == ANC_OFF)
                clk_disable_unprepare(wm2000->mclk);
 
-       return 0;
+       return ret;
 }
 
 static int wm2000_anc_set_mode(struct wm2000_priv *wm2000)