All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: haibo.chen@nxp.com, linux-input@vger.kernel.org,
	Fabio Estevam <fabio.estevam@nxp.com>
Subject: [PATCH] Input: imx6ul_tsc - fix error handling
Date: Wed, 12 Apr 2017 08:20:10 -0300	[thread overview]
Message-ID: <1491996010-19947-1-git-send-email-festevam@gmail.com> (raw)

From: Fabio Estevam <fabio.estevam@nxp.com>

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 <fabio.estevam@nxp.com>
---
 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)
-- 
2.7.4


             reply	other threads:[~2017-04-12 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 11:20 Fabio Estevam [this message]
2017-04-12 15:43 ` [PATCH] Input: imx6ul_tsc - fix error handling Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491996010-19947-1-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=fabio.estevam@nxp.com \
    --cc=haibo.chen@nxp.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.