Skip to contentSkip to conversation

Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 5, 2020 – Sep 14, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()

If imx6ul_tsc_init() fails then we need to clean up the clocks.

I reversed the "if (input_dev->users) {" condition to make the code a bit simpler.

Fixes 6cc527b05847 ("Input: imx6ul_tsc - propagate the errors")
---
 drivers/input/touchscreen/imx6ul_tsc.c | 27 +++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/input/touchscreen/imx6ul_tsc.c +16 -11
index 9ed258854349..5e6ba5c4eca2 100644
@@ -530,20 +530,25 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
 
 	mutex_lock(&input_dev->mutex);
 
-	if (input_dev->users) {
-		retval = clk_prepare_enable(tsc->adc_clk);
-		if (retval)
-			goto out;
-
-		retval = clk_prepare_enable(tsc->tsc_clk);
-		if (retval) {
-			clk_disable_unprepare(tsc->adc_clk);
-			goto out;
-		}
+	if (!input_dev->users)
+		goto out;
 
-		retval = imx6ul_tsc_init(tsc);
+	retval = clk_prepare_enable(tsc->adc_clk);
+	if (retval)
+		goto out;
+
+	retval = clk_prepare_enable(tsc->tsc_clk);
+	if (retval) {
+		clk_disable_unprepare(tsc->adc_clk);
+		goto out;
 	}
 
+	retval = imx6ul_tsc_init(tsc);
+	if (retval) {
+		clk_disable_unprepare(tsc->tsc_clk);
+		clk_disable_unprepare(tsc->adc_clk);
+		goto out;
+	}
 out:
 	mutex_unlock(&input_dev->mutex);
 	return retval;
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 7 lines · Dan Carpenter

If imx6ul_tsc_init() fails then we need to clean up the clocks.

I reversed the "if (input_dev->users) {" condition to make the code a bit simpler.

Fixes 6cc527b05847 ("Input: imx6ul_tsc - propagate the errors")

Applied, thank you.

There is also an opportunity to factor out some common code from open/close and suspend/resume, I'll send out a patch in a moment.

Thanks.

Signature · 1 line
Dmitry