linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: imx6ul_tsc - fix error handling
@ 2017-04-12 11:20 Fabio Estevam
  2017-04-12 15:43 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2017-04-12 11:20 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: haibo.chen, linux-input, Fabio Estevam

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: imx6ul_tsc - fix error handling
  2017-04-12 11:20 [PATCH] Input: imx6ul_tsc - fix error handling Fabio Estevam
@ 2017-04-12 15:43 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2017-04-12 15:43 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: haibo.chen, linux-input, Fabio Estevam

On Wed, Apr 12, 2017 at 08:20:10AM -0300, Fabio Estevam wrote:
> 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>

Applied, thank you.

> ---
>  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
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-12 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-12 11:20 [PATCH] Input: imx6ul_tsc - fix error handling Fabio Estevam
2017-04-12 15:43 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).