in pic32_rtc_probe(), the return value of function clk_prepare_enable() should be checked, since it may fail. using devm_clk_get_enabled() instead of devm_clk_get() and clk_prepare_enable() can avoid this problem. Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@xxxxxxx> --- drivers/rtc/rtc-pic32.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-pic32.c b/drivers/rtc/rtc-pic32.c index 4f85e0c3d757..d8000275679e 100644 --- a/drivers/rtc/rtc-pic32.c +++ b/drivers/rtc/rtc-pic32.c @@ -312,7 +312,7 @@ static int pic32_rtc_probe(struct platform_device *pdev) if (IS_ERR(pdata->reg_base)) return PTR_ERR(pdata->reg_base); - pdata->clk = devm_clk_get(&pdev->dev, NULL); + pdata->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(pdata->clk)) { dev_err(&pdev->dev, "failed to find rtc clock source\n"); ret = PTR_ERR(pdata->clk); @@ -326,8 +326,6 @@ static int pic32_rtc_probe(struct platform_device *pdev) if (IS_ERR(pdata->rtc)) return PTR_ERR(pdata->rtc); - clk_prepare_enable(pdata->clk); - pic32_rtc_enable(pdata, 1); device_init_wakeup(&pdev->dev, 1); @@ -358,7 +356,6 @@ static int pic32_rtc_probe(struct platform_device *pdev) err_nortc: pic32_rtc_enable(pdata, 0); - clk_disable_unprepare(pdata->clk); return ret; } -- 2.17.1