From patchwork Wed Apr 12 11:20:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 9677231 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 06D7D60325 for ; Wed, 12 Apr 2017 11:20:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECBA02860C for ; Wed, 12 Apr 2017 11:20:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E176528635; Wed, 12 Apr 2017 11:20:38 +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 0E6452861C for ; Wed, 12 Apr 2017 11:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753846AbdDLLUa (ORCPT ); Wed, 12 Apr 2017 07:20:30 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:34884 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753887AbdDLLU0 (ORCPT ); Wed, 12 Apr 2017 07:20:26 -0400 Received: by mail-qk0-f193.google.com with SMTP id k139so3435630qke.2 for ; Wed, 12 Apr 2017 04:20:26 -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=k5XJFa2EMW4xwToFo9dwIIqeWfvrXI6fnHR6Y0wmF4I=; b=loPO5OaqngZLdAZCmOApldif39MXeN2of751j+PCcl8ujzEU8XR5vmb7O6NIDSGg6X mkg87v+a5pc8iGAaXQstMabjUtPgN1ni5lNLzpPLpRGZsPvXpElrbEaedFOnzMASb6JJ muSVrNdcgcvRx7Nq6ZgCRFO1TSJtl1BJQ6q6SAn65REMzFIs6Opa81Wv/Joa+YbdYkuv 0faMOHtvamZkM0MKpRwWZA1smGgOvI8Fm7T+Yd+mhvxwEMctzxvVePgaNw4dIykd03TF VRknmuFAU2R2ngYobwE/bZPRL2ECRMP/Rr78xOfEeX5htIM57IU/0bt7FAP02ZJB+8nQ 9KKg== 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=k5XJFa2EMW4xwToFo9dwIIqeWfvrXI6fnHR6Y0wmF4I=; b=ldc9de+uXe5iFtWe20Q+joFDX4WoZ5K2mqIKG00czBiNO35eVIXmmmt0HwkbSTWeZr upW0mXvIBDuBcuvSyfU5ZPzHSiDZt1zk0+0KIUO4UB1hsOrauhXota54RW7URtb7MvWb tQJr64iI9gni8JO3ihvShuIiDX/D5gRs6ZctlhmmoSFbd7vZTK9rIQFO319XJD8saTT5 M0Hm7OyYPouHizxBfRHmFSlJXQzrrlNsScsX1RDXKtWDkxbNgEOesgqW2MD7GCrfoxnN BnZKeqFhEIXPRRddSx6B+BGGoQ5Ib+mvQ5dOgTVYHbeV++0iW67ox8QRfrEb2POX7F5E gADg== X-Gm-Message-State: AFeK/H24OSdtJ+vbd8lqDXLz3FjWZhypLQ0mmA6VutjT7XXHNkwwLUmockMqoE4Sdb3JUw== X-Received: by 10.55.153.199 with SMTP id b190mr58089194qke.305.1491996020856; Wed, 12 Apr 2017 04:20:20 -0700 (PDT) Received: from localhost.localdomain ([189.61.213.245]) by smtp.gmail.com with ESMTPSA id f128sm13137385qkd.62.2017.04.12.04.20.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Apr 2017 04:20:20 -0700 (PDT) From: Fabio Estevam To: dmitry.torokhov@gmail.com Cc: haibo.chen@nxp.com, linux-input@vger.kernel.org, Fabio Estevam Subject: [PATCH] Input: imx6ul_tsc - fix error handling Date: Wed, 12 Apr 2017 08:20:10 -0300 Message-Id: <1491996010-19947-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 If imx6ul_tsc_init() fails we should not return directly. We should disable the previously acquired clocks in this case. Signed-off-by: Fabio Estevam --- drivers/input/touchscreen/imx6ul_tsc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index 7098e0a..ee82a97 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -337,11 +337,20 @@ static int imx6ul_tsc_open(struct input_dev *input_dev) dev_err(tsc->dev, "Could not prepare or enable the tsc clock: %d\n", err); - clk_disable_unprepare(tsc->adc_clk); - return err; + goto disable_adc_clk; } - return imx6ul_tsc_init(tsc); + err = imx6ul_tsc_init(tsc); + if (err) + goto disable_tsc_clk; + + return 0; + +disable_tsc_clk: + clk_disable_unprepare(tsc->tsc_clk); +disable_adc_clk: + clk_disable_unprepare(tsc->adc_clk); + return err; } static void imx6ul_tsc_close(struct input_dev *input_dev)