]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: camif-core: Add check for clk_enable()
authorJiasheng Jiang <jiashengjiangcool@gmail.com>
Mon, 25 Nov 2024 19:18:17 +0000 (19:18 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 19 Dec 2024 11:50:18 +0000 (12:50 +0100)
Add check for the return value of clk_enable() to gurantee the success.

Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/samsung/s3c-camif/camif-core.c

index de6e8f1518496a4e9163f649b4acc7be324b972c..221e3c447f361d7716b76eb92d859ddb190f89c7 100644 (file)
@@ -527,10 +527,19 @@ static void s3c_camif_remove(struct platform_device *pdev)
 static int s3c_camif_runtime_resume(struct device *dev)
 {
        struct camif_dev *camif = dev_get_drvdata(dev);
+       int ret;
+
+       ret = clk_enable(camif->clock[CLK_GATE]);
+       if (ret)
+               return ret;
 
-       clk_enable(camif->clock[CLK_GATE]);
        /* null op on s3c244x */
-       clk_enable(camif->clock[CLK_CAM]);
+       ret = clk_enable(camif->clock[CLK_CAM]);
+       if (ret) {
+               clk_disable(camif->clock[CLK_GATE]);
+               return ret;
+       }
+
        return 0;
 }