From patchwork Thu Jul 20 15:53:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9855247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7ED0C60392 for ; Thu, 20 Jul 2017 15:54:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D2C7286B2 for ; Thu, 20 Jul 2017 15:54:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61CE6286D6; Thu, 20 Jul 2017 15:54:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2557286B2 for ; Thu, 20 Jul 2017 15:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936505AbdGTPyg (ORCPT ); Thu, 20 Jul 2017 11:54:36 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:62184 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934344AbdGTPyf (ORCPT ); Thu, 20 Jul 2017 11:54:35 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MhUV0-1dCgWB415u-00MZor; Thu, 20 Jul 2017 17:54:26 +0200 From: Arnd Bergmann To: Aaro Koskinen , Tony Lindgren Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/12] ARM: omap1/ams-delta: warn about failed regulator enable Date: Thu, 20 Jul 2017 17:53:44 +0200 Message-Id: <20170720155410.3251043-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170720154616.3250481-1-arnd@arndb.de> References: <20170720154616.3250481-1-arnd@arndb.de> X-Provags-ID: V03:K0:6HwnaJ84zOYCAlhUNMmm89G3kOxuoRgRquwZ18OivjJ5u/Eibpx WMmhKaooBYZdiESY+b0T5nqVHRbTZGMhgpUQSv8KiAM8528rGPc7O+wcEzA9pxMxOAVFOzE XG2qPiYmoXJkm+VFWgWML4PKpr8mioVr94V6cnmjg9U61ZblnH+b7PbFFRslq8Yhze1VIvk 7PW1oOuia/WFAkAN+emZg== X-UI-Out-Filterresults: notjunk:1; V01:K0:1p+WNOW+2kU=:UffuASmKOopQz50qLIVw1/ XjqWffCuUD5w6+CPGRtW09sGHsF4LojNisZeNv+W7LubvWV8YcLUpWXGjOVXNBRBGtnnrFhIn N7ohl43PdOQ2xe2sgGhAfzd1xCEPs/vSZpuW/X5WKo/xO4EV7O/OOkI+daY/Qtnf589nhGjDn JJHozL9XYCMm0mZl5pixn5Kffxw3y4McO/vFto5xaW88xZyz2bs0zfN1HSpqwVTjjZVGtY14R iOiL/dVIAfdRsPhpSRz4Lp4WEqSOG3yRHHRiHmVqDQ1nystmw6EGeeq3uHh/ZCyOaKSSlhBQ5 6eF1sNMnEccSemSDk7Sra47dRC7UKc+VLgWEP1X9Eh3qqxkGz+Ddp84dG1AKYqRv3434iRJv2 XRE1fHyFfVYvZJFN9NHuesjr0OgGmWWMwNbQqN1lBgQuvRMhbYarU2NXwWyCXYF8Bb6eJmzy3 nzFviRP6FuoulvjssOe8jF5/9LDp8Vf4A8+WqYzfbWVj87Gs+rjdKsKXG0JEKQO2OJWEh9pjY hQgr0AKRml54W4dIJ+1ZZDROilCe9u0gIozBfS1mm3r1XU19dzFK1OEwWW5fqYsLJKc29xRNh vUd4m+OHzPpS1zcWl17TMxcsBvWPRpV9CjMbICqRZ2nhWOECRlAQ9Ll/sqaBQNxQLRFr5MWJG nP1ne0hK4EOYRNySffZzu3kLDE/DbEqXuAVz58NxvXGY7+0vTz0OwitJR/TMKeesNXVzsRhgL 0zkIDGB8PCzQFN6O31XHrHmJdTaS767bHFlFng== Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The modem pm handler in the ams-delta board uses regulator_enable() but does not check for a successful return code: board-ams-delta.c:521:3: error: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Werror=unused-result] It is not easy to propagate that return code to the callers in uart_configure_port/uart_suspend_port/uart_resume_port, unless we change all UART drivers, and it is unclear what those would do with the return code. Instead, this patch uses a runtime warning to replace the compiletime warning. I have checked that the regulator in question is hardcoded to a fixed-voltage GPIO regulator, and that should never fail to get enabled if I understand the code right. Acked-by: Tony Lindgren Acked-by: Aaro Koskinen Link: https://patchwork.kernel.org/patch/8391981/ Signed-off-by: Arnd Bergmann --- Originally sent in Feb 2016, but it got lost for some reason --- arch/arm/mach-omap1/board-ams-delta.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 6613a6ff5dbc..6cbc69c92913 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -510,6 +510,7 @@ static void __init ams_delta_init(void) static void modem_pm(struct uart_port *port, unsigned int state, unsigned old) { struct modem_private_data *priv = port->private_data; + int ret; if (IS_ERR(priv->regulator)) return; @@ -518,9 +519,16 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old) return; if (state == 0) - regulator_enable(priv->regulator); + ret = regulator_enable(priv->regulator); else if (old == 0) - regulator_disable(priv->regulator); + ret = regulator_disable(priv->regulator); + else + ret = 0; + + if (ret) + dev_warn(port->dev, + "ams_delta modem_pm: failed to %sable regulator: %d\n", + state ? "dis" : "en", ret); } static struct plat_serial8250_port ams_delta_modem_ports[] = {