aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-20 01:46:44 -0500
committerMyungJoo Ham <myungjoo.ham@samsung.com>2012-11-21 06:00:40 -0500
commit00af4b16e098f7899d78c7009f0b525c9c512f94 (patch)
treea73ea5686d6008c8e99d80027019f520f6c82069 /drivers/extcon
parent68c9274d0fd1f66c6d105c52a61268d943e30862 (diff)
extcon: max77693: Fix incorrect error check and return value
irq_create_mapping() returns 0 if it fails to provide a valid irq number. 'ret' needs to be updated with a negative error code before returning from probe to signal probe failure. While at it, also corrected the 'virq' type to unsigned from signed. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-max77693.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a17d0d91ada2..2a0f397885fd 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -686,11 +686,13 @@ static int __devinit 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,8 +704,6 @@ static int __devinit 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 }
@@ -768,6 +768,8 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
768err_extcon: 768err_extcon:
769 kfree(info->edev); 769 kfree(info->edev);
770err_irq: 770err_irq:
771 while (--i >= 0)
772 free_irq(muic_irqs[i].virq, info);
771err_regmap: 773err_regmap:
772 kfree(info); 774 kfree(info);
773err_kfree: 775err_kfree: