Skip to content

Commit

Permalink
rtc: rtc-coh901331: use devm_clk_get()
Browse files Browse the repository at this point in the history
Use devm_clk_get() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed Feb 22, 2013
1 parent 0db29c1 commit 3b759d7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/rtc/rtc-coh901331.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ static int __exit coh901331_remove(struct platform_device *pdev)
if (rtap) {
rtc_device_unregister(rtap->rtc);
clk_unprepare(rtap->clk);
clk_put(rtap->clk);
platform_set_drvdata(pdev, NULL);
}

Expand Down Expand Up @@ -196,7 +195,7 @@ static int __init coh901331_probe(struct platform_device *pdev)
"RTC COH 901 331 Alarm", rtap))
return -EIO;

rtap->clk = clk_get(&pdev->dev, NULL);
rtap->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(rtap->clk)) {
ret = PTR_ERR(rtap->clk);
dev_err(&pdev->dev, "could not get clock\n");
Expand All @@ -207,7 +206,7 @@ static int __init coh901331_probe(struct platform_device *pdev)
ret = clk_prepare_enable(rtap->clk);
if (ret) {
dev_err(&pdev->dev, "could not enable clock\n");
goto out_no_clk_prepenable;
return ret;
}
clk_disable(rtap->clk);

Expand All @@ -224,8 +223,6 @@ static int __init coh901331_probe(struct platform_device *pdev)
out_no_rtc:
platform_set_drvdata(pdev, NULL);
clk_unprepare(rtap->clk);
out_no_clk_prepenable:
clk_put(rtap->clk);
return ret;
}

Expand Down

0 comments on commit 3b759d7

Please sign in to comment.