aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:19:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:32 -0400
commit17581718051076714d72ef24f46dc08402cd5373 (patch)
tree795638e146997a3bde92abc651281f48959e95e2
parenta5aa777692139c00922d8a8f2a179d2ab0e890e1 (diff)
rtc: rtc-x1205: use devm_rtc_device_register()
devm_rtc_device_register() is device managed and makes 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>
-rw-r--r--drivers/rtc/rtc-x1205.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index f36e59c6bc01..fa9b0679fb60 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -630,8 +630,8 @@ static int x1205_probe(struct i2c_client *client,
630 630
631 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); 631 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
632 632
633 rtc = rtc_device_register(x1205_driver.driver.name, &client->dev, 633 rtc = devm_rtc_device_register(&client->dev, x1205_driver.driver.name,
634 &x1205_rtc_ops, THIS_MODULE); 634 &x1205_rtc_ops, THIS_MODULE);
635 635
636 if (IS_ERR(rtc)) 636 if (IS_ERR(rtc))
637 return PTR_ERR(rtc); 637 return PTR_ERR(rtc);
@@ -653,21 +653,13 @@ static int x1205_probe(struct i2c_client *client,
653 653
654 err = x1205_sysfs_register(&client->dev); 654 err = x1205_sysfs_register(&client->dev);
655 if (err) 655 if (err)
656 goto exit_devreg; 656 return err;
657 657
658 return 0; 658 return 0;
659
660exit_devreg:
661 rtc_device_unregister(rtc);
662
663 return err;
664} 659}
665 660
666static int x1205_remove(struct i2c_client *client) 661static int x1205_remove(struct i2c_client *client)
667{ 662{
668 struct rtc_device *rtc = i2c_get_clientdata(client);
669
670 rtc_device_unregister(rtc);
671 x1205_sysfs_unregister(&client->dev); 663 x1205_sysfs_unregister(&client->dev);
672 return 0; 664 return 0;
673} 665}