memory: mtk-smi: Handle return value of clk_prepare_enable
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Thu, 10 Aug 2017 05:17:32 +0000 (10:47 +0530)
committerJoerg Roedel <jroedel@suse.de>
Tue, 15 Aug 2017 15:46:23 +0000 (17:46 +0200)
clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/memory/mtk-smi.c

index a3ff19aed087990df5627dc02cdcd58cc0b13bf2..13f8c45dbf0dc7ed9a9f70a3d19a5b56a574fa83 100644 (file)
@@ -327,6 +327,7 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
        struct mtk_smi *common;
        struct resource *res;
        enum mtk_smi_gen smi_gen;
+       int ret;
 
        if (!dev->pm_domain)
                return -EPROBE_DEFER;
@@ -361,7 +362,9 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
                if (IS_ERR(common->clk_async))
                        return PTR_ERR(common->clk_async);
 
-               clk_prepare_enable(common->clk_async);
+               ret = clk_prepare_enable(common->clk_async);
+               if (ret)
+                       return ret;
        }
        pm_runtime_enable(dev);
        platform_set_drvdata(pdev, common);