rtc: s3c: Handle clock prepare failures in probe
authorKrzysztof Kozlowski <krzk@kernel.org>
Fri, 16 Jun 2017 19:28:06 +0000 (21:28 +0200)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sat, 24 Jun 2017 20:52:40 +0000 (22:52 +0200)
clk_prepare_enable() can fail so handle such case.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-s3c.c

index c666b95fb8d7fa9c441c9063fb2ef244aa6d0465..0cb2f27a30b419621bff7b4ac67e819a01172fb3 100644 (file)
@@ -498,7 +498,9 @@ static int s3c_rtc_probe(struct platform_device *pdev)
                        dev_dbg(&pdev->dev, "probe deferred due to missing rtc clk\n");
                return ret;
        }
-       clk_prepare_enable(info->rtc_clk);
+       ret = clk_prepare_enable(info->rtc_clk);
+       if (ret)
+               return ret;
 
        if (info->data->needs_src_clk) {
                info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
@@ -512,7 +514,9 @@ static int s3c_rtc_probe(struct platform_device *pdev)
                                        "probe deferred due to missing rtc src clk\n");
                        goto err_src_clk;
                }
-               clk_prepare_enable(info->rtc_src_clk);
+               ret = clk_prepare_enable(info->rtc_src_clk);
+               if (ret)
+                       goto err_src_clk;
        }
 
        /* check to see if everything is setup correctly */