Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jingoo Han and committed by
Linus Torvalds
fac42b41 618c3003

+5 -13
+5 -13
drivers/rtc/rtc-rx8025.c
··· 549 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 553 if (!rx8025) { 554 554 dev_err(&adapter->dev, "failed to alloc memory\n"); 555 555 err = -ENOMEM; ··· 562 562 563 563 err = rx8025_init_client(client, &need_reset); 564 564 if (err) 565 - goto errout_free; 565 + goto errout; 566 566 567 567 if (need_reset) { 568 568 struct rtc_time tm; ··· 572 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 576 &rx8025_rtc_ops, THIS_MODULE); 577 577 if (IS_ERR(rx8025->rtc)) { 578 578 err = PTR_ERR(rx8025->rtc); 579 579 dev_err(&client->dev, "unable to register the class device\n"); 580 - goto errout_free; 580 + goto errout; 581 581 } 582 582 583 583 if (client->irq > 0) { ··· 586 586 0, "rx8025", client); 587 587 if (err) { 588 588 dev_err(&client->dev, "unable to request IRQ\n"); 589 - goto errout_reg; 589 + goto errout; 590 590 } 591 591 } 592 592 ··· 602 602 errout_irq: 603 603 if (client->irq > 0) 604 604 free_irq(client->irq, client); 605 - 606 - errout_reg: 607 - rtc_device_unregister(rx8025->rtc); 608 - 609 - errout_free: 610 - kfree(rx8025); 611 605 612 606 errout: 613 607 dev_err(&adapter->dev, "probing for rx8025 failed\n"); ··· 623 629 } 624 630 625 631 rx8025_sysfs_unregister(&client->dev); 626 - rtc_device_unregister(rx8025->rtc); 627 - kfree(rx8025); 628 632 return 0; 629 633 } 630 634