aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-03-09 04:46:45 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-03-12 04:34:39 -0400
commit54fc4037ac449acf96ab88c3e65633c997df8a84 (patch)
treeff0b6d1bbc7d1f88a2f33cf9909f392ba32b0a93
parentfd860195a4f9d661754345bd06a3adb30d12d882 (diff)
mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO
Since commit c8801a8e "regulator: core: Mark all get and enable calls as __must_check", we must check return value of regulator_enable() to silence below build warning. CC drivers/mfd/ab8500-gpadc.o drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_runtime_resume': drivers/mfd/ab8500-gpadc.c:598:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result] drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_probe': drivers/mfd/ab8500-gpadc.c:655:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result] Also convert to devm_regulator_get(), this fixes a missing regulator_put() call in ab8500_gpadc_remove(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/ab8500-gpadc.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index b1f3561b023f..5f341a50ee5a 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -594,9 +594,12 @@ static int ab8500_gpadc_runtime_suspend(struct device *dev)
594static int ab8500_gpadc_runtime_resume(struct device *dev) 594static int ab8500_gpadc_runtime_resume(struct device *dev)
595{ 595{
596 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); 596 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
597 int ret;
597 598
598 regulator_enable(gpadc->regu); 599 ret = regulator_enable(gpadc->regu);
599 return 0; 600 if (ret)
601 dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret);
602 return ret;
600} 603}
601 604
602static int ab8500_gpadc_runtime_idle(struct device *dev) 605static int ab8500_gpadc_runtime_idle(struct device *dev)
@@ -643,7 +646,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
643 } 646 }
644 647
645 /* VTVout LDO used to power up ab8500-GPADC */ 648 /* VTVout LDO used to power up ab8500-GPADC */
646 gpadc->regu = regulator_get(&pdev->dev, "vddadc"); 649 gpadc->regu = devm_regulator_get(&pdev->dev, "vddadc");
647 if (IS_ERR(gpadc->regu)) { 650 if (IS_ERR(gpadc->regu)) {
648 ret = PTR_ERR(gpadc->regu); 651 ret = PTR_ERR(gpadc->regu);
649 dev_err(gpadc->dev, "failed to get vtvout LDO\n"); 652 dev_err(gpadc->dev, "failed to get vtvout LDO\n");
@@ -652,7 +655,11 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
652 655
653 platform_set_drvdata(pdev, gpadc); 656 platform_set_drvdata(pdev, gpadc);
654 657
655 regulator_enable(gpadc->regu); 658 ret = regulator_enable(gpadc->regu);
659 if (ret) {
660 dev_err(gpadc->dev, "Failed to enable vtvout LDO: %d\n", ret);
661 goto fail_enable;
662 }
656 663
657 pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY); 664 pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY);
658 pm_runtime_use_autosuspend(gpadc->dev); 665 pm_runtime_use_autosuspend(gpadc->dev);
@@ -663,6 +670,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
663 list_add_tail(&gpadc->node, &ab8500_gpadc_list); 670 list_add_tail(&gpadc->node, &ab8500_gpadc_list);
664 dev_dbg(gpadc->dev, "probe success\n"); 671 dev_dbg(gpadc->dev, "probe success\n");
665 return 0; 672 return 0;
673
674fail_enable:
666fail_irq: 675fail_irq:
667 free_irq(gpadc->irq, gpadc); 676 free_irq(gpadc->irq, gpadc);
668fail: 677fail: