aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-max77686.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:18:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:21 -0400
commit0f64f853fc622a0b0c7ab255f8605ae40aa45d84 (patch)
treeb707a55fe215ba7936a8ccdb83455c047cdae458 /drivers/rtc/rtc-max77686.c
parentf5b1d3c5d022aeb994f94ed3372102e057925c6a (diff)
drivers/rtc/rtc-max77686.c: use devm_kzalloc()
Use devm_kzalloc() 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>
Diffstat (limited to 'drivers/rtc/rtc-max77686.c')
-rw-r--r--drivers/rtc/rtc-max77686.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 4da2a55ff88f..36b1f5cc4f41 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -505,7 +505,8 @@ static int max77686_rtc_probe(struct platform_device *pdev)
505 505
506 dev_info(&pdev->dev, "%s\n", __func__); 506 dev_info(&pdev->dev, "%s\n", __func__);
507 507
508 info = kzalloc(sizeof(struct max77686_rtc_info), GFP_KERNEL); 508 info = devm_kzalloc(&pdev->dev, sizeof(struct max77686_rtc_info),
509 GFP_KERNEL);
509 if (!info) 510 if (!info)
510 return -ENOMEM; 511 return -ENOMEM;
511 512
@@ -519,7 +520,6 @@ static int max77686_rtc_probe(struct platform_device *pdev)
519 ret = PTR_ERR(info->max77686->rtc_regmap); 520 ret = PTR_ERR(info->max77686->rtc_regmap);
520 dev_err(info->max77686->dev, "Failed to allocate register map: %d\n", 521 dev_err(info->max77686->dev, "Failed to allocate register map: %d\n",
521 ret); 522 ret);
522 kfree(info);
523 return ret; 523 return ret;
524 } 524 }
525 platform_set_drvdata(pdev, info); 525 platform_set_drvdata(pdev, info);
@@ -563,11 +563,7 @@ static int max77686_rtc_probe(struct platform_device *pdev)
563 goto err_rtc; 563 goto err_rtc;
564 } 564 }
565 565
566 goto out;
567err_rtc: 566err_rtc:
568 kfree(info);
569 return ret;
570out:
571 return ret; 567 return ret;
572} 568}
573 569
@@ -578,7 +574,6 @@ static int max77686_rtc_remove(struct platform_device *pdev)
578 if (info) { 574 if (info) {
579 free_irq(info->virq, info); 575 free_irq(info->virq, info);
580 rtc_device_unregister(info->rtc_dev); 576 rtc_device_unregister(info->rtc_dev);
581 kfree(info);
582 } 577 }
583 578
584 return 0; 579 return 0;