diff options
Diffstat (limited to 'drivers/rtc/rtc-davinci.c')
-rw-r--r-- | drivers/rtc/rtc-davinci.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c index 14c2109dbaa3..07cd03eae606 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,9 +564,6 @@ 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 | ||
@@ -589,8 +584,6 @@ 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 | ||