aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:20:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:38 -0400
commit55d735efd0132619b1887c4b5a8dcf2156f35216 (patch)
tree1ccee0e0187e9b813457226a8f0297215855adc8 /drivers/rtc
parentb4cd3d6a77b3f8acfd5b8ae9ea9dc43f831f0df9 (diff)
rtc: rtc-sa1100: use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. 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>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-sa1100.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 7e0a0887c256..00605601dbf7 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -234,14 +234,13 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
234 if (irq_1hz < 0 || irq_alarm < 0) 234 if (irq_1hz < 0 || irq_alarm < 0)
235 return -ENODEV; 235 return -ENODEV;
236 236
237 info = kzalloc(sizeof(struct sa1100_rtc), GFP_KERNEL); 237 info = devm_kzalloc(&pdev->dev, sizeof(struct sa1100_rtc), GFP_KERNEL);
238 if (!info) 238 if (!info)
239 return -ENOMEM; 239 return -ENOMEM;
240 info->clk = clk_get(&pdev->dev, NULL); 240 info->clk = devm_clk_get(&pdev->dev, NULL);
241 if (IS_ERR(info->clk)) { 241 if (IS_ERR(info->clk)) {
242 dev_err(&pdev->dev, "failed to find rtc clock source\n"); 242 dev_err(&pdev->dev, "failed to find rtc clock source\n");
243 ret = PTR_ERR(info->clk); 243 return PTR_ERR(info->clk);
244 goto err_clk;
245 } 244 }
246 info->irq_1hz = irq_1hz; 245 info->irq_1hz = irq_1hz;
247 info->irq_alarm = irq_alarm; 246 info->irq_alarm = irq_alarm;
@@ -268,8 +267,8 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
268 267
269 device_init_wakeup(&pdev->dev, 1); 268 device_init_wakeup(&pdev->dev, 1);
270 269
271 rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, 270 rtc = devm_rtc_device_register(&pdev->dev, pdev->name, &sa1100_rtc_ops,
272 THIS_MODULE); 271 THIS_MODULE);
273 272
274 if (IS_ERR(rtc)) { 273 if (IS_ERR(rtc)) {
275 ret = PTR_ERR(rtc); 274 ret = PTR_ERR(rtc);
@@ -306,9 +305,6 @@ err_dev:
306 clk_disable_unprepare(info->clk); 305 clk_disable_unprepare(info->clk);
307err_enable_clk: 306err_enable_clk:
308 platform_set_drvdata(pdev, NULL); 307 platform_set_drvdata(pdev, NULL);
309 clk_put(info->clk);
310err_clk:
311 kfree(info);
312 return ret; 308 return ret;
313} 309}
314 310
@@ -317,11 +313,8 @@ static int sa1100_rtc_remove(struct platform_device *pdev)
317 struct sa1100_rtc *info = platform_get_drvdata(pdev); 313 struct sa1100_rtc *info = platform_get_drvdata(pdev);
318 314
319 if (info) { 315 if (info) {
320 rtc_device_unregister(info->rtc);
321 clk_disable_unprepare(info->clk); 316 clk_disable_unprepare(info->clk);
322 clk_put(info->clk);
323 platform_set_drvdata(pdev, NULL); 317 platform_set_drvdata(pdev, NULL);
324 kfree(info);
325 } 318 }
326 319
327 return 0; 320 return 0;