Skip to contentSkip to conversation

Input: imx6ul_tsc - fix error handling

PATCH Applied Fabio Estevam 2 participants 2 messages Apr 12, 2017

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 Input: imx6ul_tsc - fix error handling

From: Fabio Estevam <[email protected]>

If imx6ul_tsc_init() fails we should not return directly.

We should disable the previously acquired clocks in this case.

---
 drivers/input/touchscreen/imx6ul_tsc.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/input/touchscreen/imx6ul_tsc.c +12 -3
index 7098e0a..ee82a97 100644
@@ -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)
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 7 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

If imx6ul_tsc_init() fails we should not return directly.

We should disable the previously acquired clocks in this case.

Applied, thank you.

Quoted 35 lines
---
 drivers/input/touchscreen/imx6ul_tsc.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/input/touchscreen/imx6ul_tsc.c +12 -3
index 7098e0a..ee82a97 100644
@@ -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)
Signature · 1 line
2.7.4
Signature · 1 line
Dmitry