aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rx8025.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-07-03 18:07:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:55 -0400
commitfac42b414a42e54f327ead67fa1804078b0db7be (patch)
tree3e76e1ae7af5200403b00fc3ef619bb22a6d0c73 /drivers/rtc/rtc-rx8025.c
parent618c300305c6ee7c71a1493da97c48c24205268c (diff)
rtc: rtc-rx8025: 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/rtc-rx8025.c')
-rw-r--r--drivers/rtc/rtc-rx8025.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index 0722d36b9c9a..8fa23eabcb68 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -549,7 +549,7 @@ static int rx8025_probe(struct i2c_client *client,
549 goto errout; 549 goto errout;
550 } 550 }
551 551
552 rx8025 = kzalloc(sizeof(*rx8025), GFP_KERNEL); 552 rx8025 = devm_kzalloc(&client->dev, sizeof(*rx8025), GFP_KERNEL);
553 if (!rx8025) { 553 if (!rx8025) {
554 dev_err(&adapter->dev, "failed to alloc memory\n"); 554 dev_err(&adapter->dev, "failed to alloc memory\n");
555 err = -ENOMEM; 555 err = -ENOMEM;
@@ -562,7 +562,7 @@ static int rx8025_probe(struct i2c_client *client,
562 562
563 err = rx8025_init_client(client, &need_reset); 563 err = rx8025_init_client(client, &need_reset);
564 if (err) 564 if (err)
565 goto errout_free; 565 goto errout;
566 566
567 if (need_reset) { 567 if (need_reset) {
568 struct rtc_time tm; 568 struct rtc_time tm;
@@ -572,12 +572,12 @@ static int rx8025_probe(struct i2c_client *client,
572 rx8025_set_time(&client->dev, &tm); 572 rx8025_set_time(&client->dev, &tm);
573 } 573 }
574 574
575 rx8025->rtc = rtc_device_register(client->name, &client->dev, 575 rx8025->rtc = devm_rtc_device_register(&client->dev, client->name,
576 &rx8025_rtc_ops, THIS_MODULE); 576 &rx8025_rtc_ops, THIS_MODULE);
577 if (IS_ERR(rx8025->rtc)) { 577 if (IS_ERR(rx8025->rtc)) {
578 err = PTR_ERR(rx8025->rtc); 578 err = PTR_ERR(rx8025->rtc);
579 dev_err(&client->dev, "unable to register the class device\n"); 579 dev_err(&client->dev, "unable to register the class device\n");
580 goto errout_free; 580 goto errout;
581 } 581 }
582 582
583 if (client->irq > 0) { 583 if (client->irq > 0) {
@@ -586,7 +586,7 @@ static int rx8025_probe(struct i2c_client *client,
586 0, "rx8025", client); 586 0, "rx8025", client);
587 if (err) { 587 if (err) {
588 dev_err(&client->dev, "unable to request IRQ\n"); 588 dev_err(&client->dev, "unable to request IRQ\n");
589 goto errout_reg; 589 goto errout;
590 } 590 }
591 } 591 }
592 592
@@ -603,12 +603,6 @@ errout_irq:
603 if (client->irq > 0) 603 if (client->irq > 0)
604 free_irq(client->irq, client); 604 free_irq(client->irq, client);
605 605
606errout_reg:
607 rtc_device_unregister(rx8025->rtc);
608
609errout_free:
610 kfree(rx8025);
611
612errout: 606errout:
613 dev_err(&adapter->dev, "probing for rx8025 failed\n"); 607 dev_err(&adapter->dev, "probing for rx8025 failed\n");
614 return err; 608 return err;
@@ -629,8 +623,6 @@ static int rx8025_remove(struct i2c_client *client)
629 } 623 }
630 624
631 rx8025_sysfs_unregister(&client->dev); 625 rx8025_sysfs_unregister(&client->dev);
632 rtc_device_unregister(rx8025->rtc);
633 kfree(rx8025);
634 return 0; 626 return 0;
635} 627}
636 628