diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-27 09:44:10 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-27 09:44:10 -0500 |
commit | 962b686c450493adb8596e813bdfd0e1613482e6 (patch) | |
tree | ae836829fd0fd6141aea657537e42b8e94564c38 /drivers/extcon/extcon-max77693.c | |
parent | 70e78c40ed6c25bb34d642848e485d79ffc55c26 (diff) | |
parent | df072eb97dcfb819390227649f6b7c07a90aa2df (diff) |
Merge tag 'pull_req_20121122' of git://git.kernel.org/pub/scm/linux/kernel/git/mzx/extcon into char-misc-next
MyungJoo writes:
"extcon pull request targetting Linux 3.8 for Greg KH on 2012.11.22
This is based on Linux 3.7 rc6"
Diffstat (limited to 'drivers/extcon/extcon-max77693.c')
-rw-r--r-- | drivers/extcon/extcon-max77693.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index b656dfa401a6..8c17b65eb74d 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
@@ -657,17 +657,17 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
657 | int ret, i; | 657 | int ret, i; |
658 | u8 id; | 658 | u8 id; |
659 | 659 | ||
660 | info = kzalloc(sizeof(struct max77693_muic_info), GFP_KERNEL); | 660 | info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info), |
661 | GFP_KERNEL); | ||
661 | if (!info) { | 662 | if (!info) { |
662 | dev_err(&pdev->dev, "failed to allocate memory\n"); | 663 | dev_err(&pdev->dev, "failed to allocate memory\n"); |
663 | ret = -ENOMEM; | 664 | return -ENOMEM; |
664 | goto err_kfree; | ||
665 | } | 665 | } |
666 | info->dev = &pdev->dev; | 666 | info->dev = &pdev->dev; |
667 | info->max77693 = max77693; | 667 | info->max77693 = max77693; |
668 | if (info->max77693->regmap_muic) | 668 | if (info->max77693->regmap_muic) { |
669 | dev_dbg(&pdev->dev, "allocate register map\n"); | 669 | dev_dbg(&pdev->dev, "allocate register map\n"); |
670 | else { | 670 | } else { |
671 | info->max77693->regmap_muic = devm_regmap_init_i2c( | 671 | info->max77693->regmap_muic = devm_regmap_init_i2c( |
672 | info->max77693->muic, | 672 | info->max77693->muic, |
673 | &max77693_muic_regmap_config); | 673 | &max77693_muic_regmap_config); |
@@ -675,7 +675,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
675 | ret = PTR_ERR(info->max77693->regmap_muic); | 675 | ret = PTR_ERR(info->max77693->regmap_muic); |
676 | dev_err(max77693->dev, | 676 | dev_err(max77693->dev, |
677 | "failed to allocate register map: %d\n", ret); | 677 | "failed to allocate register map: %d\n", ret); |
678 | goto err_regmap; | 678 | return ret; |
679 | } | 679 | } |
680 | } | 680 | } |
681 | platform_set_drvdata(pdev, info); | 681 | platform_set_drvdata(pdev, info); |
@@ -686,11 +686,13 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
686 | /* Support irq domain for MAX77693 MUIC device */ | 686 | /* Support irq domain for MAX77693 MUIC device */ |
687 | for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) { | 687 | for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) { |
688 | struct max77693_muic_irq *muic_irq = &muic_irqs[i]; | 688 | struct max77693_muic_irq *muic_irq = &muic_irqs[i]; |
689 | int virq = 0; | 689 | unsigned int virq = 0; |
690 | 690 | ||
691 | virq = irq_create_mapping(max77693->irq_domain, muic_irq->irq); | 691 | virq = irq_create_mapping(max77693->irq_domain, muic_irq->irq); |
692 | if (!virq) | 692 | if (!virq) { |
693 | ret = -EINVAL; | ||
693 | goto err_irq; | 694 | goto err_irq; |
695 | } | ||
694 | muic_irq->virq = virq; | 696 | muic_irq->virq = virq; |
695 | 697 | ||
696 | ret = request_threaded_irq(virq, NULL, | 698 | ret = request_threaded_irq(virq, NULL, |
@@ -702,14 +704,13 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
702 | " error :%d)\n", | 704 | " error :%d)\n", |
703 | muic_irq->irq, ret); | 705 | muic_irq->irq, ret); |
704 | 706 | ||
705 | for (i = i - 1; i >= 0; i--) | ||
706 | free_irq(muic_irq->virq, info); | ||
707 | goto err_irq; | 707 | goto err_irq; |
708 | } | 708 | } |
709 | } | 709 | } |
710 | 710 | ||
711 | /* Initialize extcon device */ | 711 | /* Initialize extcon device */ |
712 | info->edev = kzalloc(sizeof(struct extcon_dev), GFP_KERNEL); | 712 | info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev), |
713 | GFP_KERNEL); | ||
713 | if (!info->edev) { | 714 | if (!info->edev) { |
714 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); | 715 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); |
715 | ret = -ENOMEM; | 716 | ret = -ENOMEM; |
@@ -720,7 +721,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
720 | ret = extcon_dev_register(info->edev, NULL); | 721 | ret = extcon_dev_register(info->edev, NULL); |
721 | if (ret) { | 722 | if (ret) { |
722 | dev_err(&pdev->dev, "failed to register extcon device\n"); | 723 | dev_err(&pdev->dev, "failed to register extcon device\n"); |
723 | goto err_extcon; | 724 | goto err_irq; |
724 | } | 725 | } |
725 | 726 | ||
726 | /* Initialize MUIC register by using platform data */ | 727 | /* Initialize MUIC register by using platform data */ |
@@ -753,7 +754,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
753 | MAX77693_MUIC_REG_ID, &id); | 754 | MAX77693_MUIC_REG_ID, &id); |
754 | if (ret < 0) { | 755 | if (ret < 0) { |
755 | dev_err(&pdev->dev, "failed to read revision number\n"); | 756 | dev_err(&pdev->dev, "failed to read revision number\n"); |
756 | goto err_extcon; | 757 | goto err_irq; |
757 | } | 758 | } |
758 | dev_info(info->dev, "device ID : 0x%x\n", id); | 759 | dev_info(info->dev, "device ID : 0x%x\n", id); |
759 | 760 | ||
@@ -765,12 +766,9 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
765 | 766 | ||
766 | return ret; | 767 | return ret; |
767 | 768 | ||
768 | err_extcon: | ||
769 | kfree(info->edev); | ||
770 | err_irq: | 769 | err_irq: |
771 | err_regmap: | 770 | while (--i >= 0) |
772 | kfree(info); | 771 | free_irq(muic_irqs[i].virq, info); |
773 | err_kfree: | ||
774 | return ret; | 772 | return ret; |
775 | } | 773 | } |
776 | 774 | ||
@@ -783,8 +781,6 @@ static int max77693_muic_remove(struct platform_device *pdev) | |||
783 | free_irq(muic_irqs[i].virq, info); | 781 | free_irq(muic_irqs[i].virq, info); |
784 | cancel_work_sync(&info->irq_work); | 782 | cancel_work_sync(&info->irq_work); |
785 | extcon_dev_unregister(info->edev); | 783 | extcon_dev_unregister(info->edev); |
786 | kfree(info->edev); | ||
787 | kfree(info); | ||
788 | 784 | ||
789 | return 0; | 785 | return 0; |
790 | } | 786 | } |