diff options
Diffstat (limited to 'drivers/rtc/rtc-davinci.c')
| -rw-r--r-- | drivers/rtc/rtc-davinci.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c index 14c2109dbaa3..5f7982f7c1b5 100644 --- a/drivers/rtc/rtc-davinci.c +++ b/drivers/rtc/rtc-davinci.c | |||
| @@ -485,7 +485,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) | |||
| 485 | struct resource *res, *mem; | 485 | struct resource *res, *mem; |
| 486 | int ret = 0; | 486 | int ret = 0; |
| 487 | 487 | ||
| 488 | davinci_rtc = kzalloc(sizeof(struct davinci_rtc), GFP_KERNEL); | 488 | davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct davinci_rtc), GFP_KERNEL); |
| 489 | if (!davinci_rtc) { | 489 | if (!davinci_rtc) { |
| 490 | dev_dbg(dev, "could not allocate memory for private data\n"); | 490 | dev_dbg(dev, "could not allocate memory for private data\n"); |
| 491 | return -ENOMEM; | 491 | return -ENOMEM; |
| @@ -494,15 +494,13 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) | |||
| 494 | davinci_rtc->irq = platform_get_irq(pdev, 0); | 494 | davinci_rtc->irq = platform_get_irq(pdev, 0); |
| 495 | if (davinci_rtc->irq < 0) { | 495 | if (davinci_rtc->irq < 0) { |
| 496 | dev_err(dev, "no RTC irq\n"); | 496 | dev_err(dev, "no RTC irq\n"); |
| 497 | ret = davinci_rtc->irq; | 497 | return davinci_rtc->irq; |
| 498 | goto fail1; | ||
| 499 | } | 498 | } |
| 500 | 499 | ||
| 501 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 500 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 502 | if (!res) { | 501 | if (!res) { |
| 503 | dev_err(dev, "no mem resource\n"); | 502 | dev_err(dev, "no mem resource\n"); |
| 504 | ret = -EINVAL; | 503 | return -EINVAL; |
| 505 | goto fail1; | ||
| 506 | } | 504 | } |
| 507 | 505 | ||
| 508 | davinci_rtc->pbase = res->start; | 506 | davinci_rtc->pbase = res->start; |
| @@ -513,8 +511,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) | |||
| 513 | if (!mem) { | 511 | if (!mem) { |
| 514 | dev_err(dev, "RTC registers at %08x are not free\n", | 512 | dev_err(dev, "RTC registers at %08x are not free\n", |
| 515 | davinci_rtc->pbase); | 513 | davinci_rtc->pbase); |
| 516 | ret = -EBUSY; | 514 | return -EBUSY; |
| 517 | goto fail1; | ||
| 518 | } | 515 | } |
| 519 | 516 | ||
| 520 | davinci_rtc->base = ioremap(davinci_rtc->pbase, davinci_rtc->base_size); | 517 | davinci_rtc->base = ioremap(davinci_rtc->pbase, davinci_rtc->base_size); |
| @@ -529,8 +526,9 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) | |||
| 529 | davinci_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, | 526 | davinci_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, |
| 530 | &davinci_rtc_ops, THIS_MODULE); | 527 | &davinci_rtc_ops, THIS_MODULE); |
| 531 | if (IS_ERR(davinci_rtc->rtc)) { | 528 | if (IS_ERR(davinci_rtc->rtc)) { |
| 532 | dev_err(dev, "unable to register RTC device, err %ld\n", | 529 | ret = PTR_ERR(davinci_rtc->rtc); |
| 533 | PTR_ERR(davinci_rtc->rtc)); | 530 | dev_err(dev, "unable to register RTC device, err %d\n", |
| 531 | ret); | ||
| 534 | goto fail3; | 532 | goto fail3; |
| 535 | } | 533 | } |
| 536 | 534 | ||
| @@ -566,13 +564,10 @@ fail3: | |||
| 566 | iounmap(davinci_rtc->base); | 564 | iounmap(davinci_rtc->base); |
| 567 | fail2: | 565 | fail2: |
| 568 | release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size); | 566 | release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size); |
| 569 | fail1: | ||
| 570 | kfree(davinci_rtc); | ||
| 571 | |||
| 572 | return ret; | 567 | return ret; |
| 573 | } | 568 | } |
| 574 | 569 | ||
| 575 | static int __devexit davinci_rtc_remove(struct platform_device *pdev) | 570 | static int davinci_rtc_remove(struct platform_device *pdev) |
| 576 | { | 571 | { |
| 577 | struct davinci_rtc *davinci_rtc = platform_get_drvdata(pdev); | 572 | struct davinci_rtc *davinci_rtc = platform_get_drvdata(pdev); |
| 578 | 573 | ||
| @@ -589,14 +584,12 @@ static int __devexit davinci_rtc_remove(struct platform_device *pdev) | |||
| 589 | 584 | ||
| 590 | platform_set_drvdata(pdev, NULL); | 585 | platform_set_drvdata(pdev, NULL); |
| 591 | 586 | ||
| 592 | kfree(davinci_rtc); | ||
| 593 | |||
| 594 | return 0; | 587 | return 0; |
| 595 | } | 588 | } |
| 596 | 589 | ||
| 597 | static struct platform_driver davinci_rtc_driver = { | 590 | static struct platform_driver davinci_rtc_driver = { |
| 598 | .probe = davinci_rtc_probe, | 591 | .probe = davinci_rtc_probe, |
| 599 | .remove = __devexit_p(davinci_rtc_remove), | 592 | .remove = davinci_rtc_remove, |
| 600 | .driver = { | 593 | .driver = { |
| 601 | .name = "rtc_davinci", | 594 | .name = "rtc_davinci", |
| 602 | .owner = THIS_MODULE, | 595 | .owner = THIS_MODULE, |
