]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: ti: davinci-i2s: Add check for clk_enable()
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Mon, 28 Feb 2022 03:15:40 +0000 (11:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Apr 2022 12:14:45 +0000 (14:14 +0200)
[ Upstream commit ed7c9fef11931fc5d32a83d68017ff390bf5c280 ]

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

Fixes: 5f9a50c3e55e ("ASoC: Davinci: McBSP: add device tree support for McBSP")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20220228031540.3571959-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/davinci/davinci-i2s.c

index a3206e65e5e54d3abc84eea1f66fd02cd512e0bb..205841e46046a3481d67c7945bf6c6b74ca494fe 100644 (file)
@@ -721,7 +721,9 @@ static int davinci_i2s_probe(struct platform_device *pdev)
        dev->clk = clk_get(&pdev->dev, NULL);
        if (IS_ERR(dev->clk))
                return -ENODEV;
-       clk_enable(dev->clk);
+       ret = clk_enable(dev->clk);
+       if (ret)
+               goto err_put_clk;
 
        dev->dev = &pdev->dev;
        dev_set_drvdata(&pdev->dev, dev);
@@ -743,6 +745,7 @@ err_unregister_component:
        snd_soc_unregister_component(&pdev->dev);
 err_release_clk:
        clk_disable(dev->clk);
+err_put_clk:
        clk_put(dev->clk);
        return ret;
 }