]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
ASoC: fsi: Add check for clk_enable
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Wed, 2 Mar 2022 06:28:44 +0000 (14:28 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 13:18:46 +0000 (15:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1971497
[ Upstream commit 405afed8a728f23cfaa02f75bbc8bdd6b7322123 ]

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: ab6f6d85210c ("ASoC: fsi: add master clock control functions")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220302062844.46869-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
sound/soc/sh/fsi.c

index 3447dbdba1f1798822988417c3e63efa57b90e6d..6ac7df30a289010ce2948873f0ad4f9803191cf3 100644 (file)
@@ -816,14 +816,27 @@ static int fsi_clk_enable(struct device *dev,
                        return ret;
                }
 
-               clk_enable(clock->xck);
-               clk_enable(clock->ick);
-               clk_enable(clock->div);
+               ret = clk_enable(clock->xck);
+               if (ret)
+                       goto err;
+               ret = clk_enable(clock->ick);
+               if (ret)
+                       goto disable_xck;
+               ret = clk_enable(clock->div);
+               if (ret)
+                       goto disable_ick;
 
                clock->count++;
        }
 
        return ret;
+
+disable_ick:
+       clk_disable(clock->ick);
+disable_xck:
+       clk_disable(clock->xck);
+err:
+       return ret;
 }
 
 static int fsi_clk_disable(struct device *dev,