Skip to contentSkip to conversation

Input: lpc32xx_ts - check for clk_prepare_enable() error

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

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

PATCH 1/1 Input: lpc32xx_ts - check for clk_prepare_enable() error

From: Fabio Estevam <[email protected]>

clk_prepare_enable() may fail, so we better check its return value and propagate it in the case of error.

---
 drivers/input/touchscreen/lpc32xx_ts.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/input/touchscreen/lpc32xx_ts.c +8 -5
index e0baa7d..4eb31ec 100644
@@ -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)
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 6 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

clk_prepare_enable() may fail, so we better check its return value and propagate it in the case of error.

Applied, thank you.

Quoted 47 lines
---
 drivers/input/touchscreen/lpc32xx_ts.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/input/touchscreen/lpc32xx_ts.c +8 -5
index e0baa7d..4eb31ec 100644
@@ -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)
Signature · 1 line
2.7.4
Signature · 1 line
Dmitry