From patchwork Wed Apr 12 11:29:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 9677251 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 DA91060383 for ; Wed, 12 Apr 2017 11:29:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC7AF28173 for ; Wed, 12 Apr 2017 11:29:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0E6428635; Wed, 12 Apr 2017 11:29:50 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 3171928173 for ; Wed, 12 Apr 2017 11:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752086AbdDLL3t (ORCPT ); Wed, 12 Apr 2017 07:29:49 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:34308 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752016AbdDLL3s (ORCPT ); Wed, 12 Apr 2017 07:29:48 -0400 Received: by mail-qt0-f195.google.com with SMTP id r49so3334825qta.1 for ; Wed, 12 Apr 2017 04:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YBOsXouS55Zb8E9TBnLhLx9auyLKJRSiaGfi24tUiXs=; b=bW0umuOjDi3KkjPNtCd4eHCqruKLhlqYe36huB5xVfXcjQOW6MGv89SzEiGLM6e0Iz c3bOjS7Y1AGeOzsLV81En2rzNvC3jS1Igbkwvk85YCC+MvO4x5eAB5t0v9SnaY5ZSvjE Mn6U9ASwoBja72r6WgvQZy5+msn+gkPHul3H4qsAAg68cRY5HHjZza72zfPhKtJrg5zF ljIu0xWFZ2et4cJ0gFiWBh8IpcHCgcbxUQZnyYUzlIy2+hMYP0gCHSGk805TeRODTyRj eh+6TEZK0lTLR2tSnGnbYew4DfAPuXauWxXpP8YHxKSE+E8Yw+QgAdsE1e1xW8LhzvcC 92Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YBOsXouS55Zb8E9TBnLhLx9auyLKJRSiaGfi24tUiXs=; b=VPWJQeQZqMYYmS+WU67qTJlHQrK1PgYGrgHApLNQGJUqaP3HYiRx2yB+QRUVIQQqrR F9QGaoybizIM0ATaGmuJilAE7HO3EijRM9UwCMYLfLUd4LZ8XEafYhow5X3tFwV0Q209 lAvQIlzleNE21zewOvVu+6Jc19YC5Tt4arWDB9qCpgUr3GkH0MbTsMTHCPBW13g3UAxc 2h9ZLV0+HgzFPRscrHhcZjn4nxQjUsPLHsPIuhOofi/3A7MAcv547LSV7pg0WdRPurA5 hWhdOWqjkxW1EaloqyN5D1tUK0G/ofNItV2T+7EnoKBwfH90HGLRsPjHBcdVqEufTgKD j9Nw== X-Gm-Message-State: AN3rC/7jKw7A7alOTIBUmxpddqnDTCv/DzSshvItohQgzk/ANTUiBkifJdu3GLLvbzpffw== X-Received: by 10.237.53.124 with SMTP id b57mr12332258qte.240.1491996587469; Wed, 12 Apr 2017 04:29:47 -0700 (PDT) Received: from localhost.localdomain ([189.61.213.245]) by smtp.gmail.com with ESMTPSA id g66sm13120369qkb.55.2017.04.12.04.29.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Apr 2017 04:29:46 -0700 (PDT) From: Fabio Estevam To: dmitry.torokhov@gmail.com Cc: vz@mleia.com, linux-input@vger.kernel.org, Fabio Estevam Subject: [PATCH] Input: lpc32xx_ts - check for clk_prepare_enable() error Date: Wed, 12 Apr 2017 08:29:23 -0300 Message-Id: <1491996563-23095-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam clk_prepare_enable() may fail, so we better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam --- drivers/input/touchscreen/lpc32xx_ts.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c index e0baa7d..4eb31ec 100644 --- a/drivers/input/touchscreen/lpc32xx_ts.c +++ b/drivers/input/touchscreen/lpc32xx_ts.c @@ -142,11 +142,14 @@ static void lpc32xx_stop_tsc(struct lpc32xx_tsc *tsc) clk_disable_unprepare(tsc->clk); } -static void lpc32xx_setup_tsc(struct lpc32xx_tsc *tsc) +static int lpc32xx_setup_tsc(struct lpc32xx_tsc *tsc) { u32 tmp; + int err; - clk_prepare_enable(tsc->clk); + err = clk_prepare_enable(tsc->clk); + if (err) + return err; tmp = tsc_readl(tsc, LPC32XX_TSC_CON) & ~LPC32XX_TSC_ADCCON_POWER_UP; @@ -184,15 +187,15 @@ static void lpc32xx_setup_tsc(struct lpc32xx_tsc *tsc) /* Enable automatic ts event capture */ tsc_writel(tsc, LPC32XX_TSC_CON, tmp | LPC32XX_TSC_ADCCON_AUTO_EN); + + return 0; } static int lpc32xx_ts_open(struct input_dev *dev) { struct lpc32xx_tsc *tsc = input_get_drvdata(dev); - lpc32xx_setup_tsc(tsc); - - return 0; + return lpc32xx_setup_tsc(tsc); } static void lpc32xx_ts_close(struct input_dev *dev)