From patchwork Sat Mar 9 09:46:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 2241381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 47DCBDF2F2 for ; Sat, 9 Mar 2013 09:50:11 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UEGMo-0004ER-Vw; Sat, 09 Mar 2013 09:47:03 +0000 Received: from mail-pb0-f52.google.com ([209.85.160.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UEGMk-0004As-DS for linux-arm-kernel@lists.infradead.org; Sat, 09 Mar 2013 09:46:59 +0000 Received: by mail-pb0-f52.google.com with SMTP id ma3so2073048pbc.25 for ; Sat, 09 Mar 2013 01:46:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:subject:from:to:cc:date:content-type:x-mailer :content-transfer-encoding:mime-version:x-gm-message-state; bh=RmcgA73JKFlj4eTTILyA7x8Xie04WDymyzUN4d/aUFw=; b=CbCAqzw8Qda4Q4c4O1s6w1asgXef6oUarEQGRln0k8fL5j7mzamDCA3RwrsmpE+Va+ 2wrYCOIYEzWqhT4Z+1mqt/7zPkXGev3Uf0pVOSK40PZk7Mge+smh2H4Ms1N8bLK+unmi a/rOp8gRYhdBM1O2Pj5skqNjz/HCO4doGu3KwEYrmgvHKY1zJvNQFC1zYqPBTkMaSwPM uy8757pPmw6pM0ISDSi2RupisjJAcxK9/aNYHMcF8iZXG3F5UYT/D0otrh2FIRrG+G1e 6d4t5AldN7tgY8TgW3CfFvqg3Wqn/DcC524o6ha6A2Boo9bhnotsp/I3c6KyDoAXd3hF M96g== X-Received: by 10.68.211.69 with SMTP id na5mr9945235pbc.71.1362822416525; Sat, 09 Mar 2013 01:46:56 -0800 (PST) Received: from [192.168.0.102] (122-121-48-81.dynamic.hinet.net. [122.121.48.81]) by mx.google.com with ESMTPS id vd4sm9458514pbc.35.2013.03.09.01.46.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Mar 2013 01:46:55 -0800 (PST) Message-ID: <1362822405.8907.1.camel@phoenix> Subject: [PATCH v2] mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO From: Axel Lin To: Samuel Ortiz Date: Sat, 09 Mar 2013 17:46:45 +0800 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQldd9g0FipITpLPKJ5eM4Nu7v/lH4WwCzfZmdTYcjiG5X7atAPkALYLDmh8039IwRnfeZFh X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130309_044658_841548_B59AA76C X-CRM114-Status: GOOD ( 12.97 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.52 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linus Walleij , Arun Murthy , Lee Jones , linux-arm-kernel@lists.infradead.org, Srinidhi Kasagar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- v2: In the case of goto fail_enable, we should call regulator_put instead of regulator_disable. However, the regulator_put call is also missed in ab8500_gpadc_remove(). Thus a simpler fix is to convert regulator_get to devm_regulator_get. drivers/mfd/ab8500-gpadc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index b1f3561..5f341a5 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) static int ab8500_gpadc_runtime_resume(struct device *dev) { struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); + int ret; - regulator_enable(gpadc->regu); - return 0; + ret = regulator_enable(gpadc->regu); + if (ret) + dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret); + return ret; } static int ab8500_gpadc_runtime_idle(struct device *dev) @@ -643,7 +646,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) } /* VTVout LDO used to power up ab8500-GPADC */ - gpadc->regu = regulator_get(&pdev->dev, "vddadc"); + gpadc->regu = devm_regulator_get(&pdev->dev, "vddadc"); if (IS_ERR(gpadc->regu)) { ret = PTR_ERR(gpadc->regu); dev_err(gpadc->dev, "failed to get vtvout LDO\n"); @@ -652,7 +655,11 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gpadc); - regulator_enable(gpadc->regu); + ret = regulator_enable(gpadc->regu); + if (ret) { + dev_err(gpadc->dev, "Failed to enable vtvout LDO: %d\n", ret); + goto fail_enable; + } pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY); pm_runtime_use_autosuspend(gpadc->dev); @@ -663,6 +670,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) list_add_tail(&gpadc->node, &ab8500_gpadc_list); dev_dbg(gpadc->dev, "probe success\n"); return 0; + +fail_enable: fail_irq: free_irq(gpadc->irq, gpadc); fail: