]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: tegra-cec: Handle errors of clk_prepare_enable()
authorEvgeny Novikov <novikov@ispras.ru>
Wed, 28 Jul 2021 14:44:32 +0000 (16:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:31 +0000 (12:26 +0200)
[ Upstream commit 38367073c796a37a61549b1f66a71b3adb03802d ]

tegra_cec_probe() and tegra_cec_resume() ignored possible errors of
clk_prepare_enable(). The patch fixes this.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/tegra-cec/tegra_cec.c

index a632602131f210f02a81163e66569cf6c559becf..efb80a78d2fa2ebdc0e178ead93576e9cb1095f9 100644 (file)
@@ -366,7 +366,11 @@ static int tegra_cec_probe(struct platform_device *pdev)
                return -ENOENT;
        }
 
-       clk_prepare_enable(cec->clk);
+       ret = clk_prepare_enable(cec->clk);
+       if (ret) {
+               dev_err(&pdev->dev, "Unable to prepare clock for CEC\n");
+               return ret;
+       }
 
        /* set context info. */
        cec->dev = &pdev->dev;
@@ -446,9 +450,7 @@ static int tegra_cec_resume(struct platform_device *pdev)
 
        dev_notice(&pdev->dev, "Resuming\n");
 
-       clk_prepare_enable(cec->clk);
-
-       return 0;
+       return clk_prepare_enable(cec->clk);
 }
 #endif