linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Input: at32psif: handle clk_enable return value
@ 2015-09-11  3:02 WEN Pingbo
  2015-09-11  3:02 ` [PATCH 2/2] Input: lpc32xx: " WEN Pingbo
  2015-09-11  3:10 ` [PATCH 1/2] Input: at32psif: " Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: WEN Pingbo @ 2015-09-11  3:02 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: broonie, linux-input, WEN Pingbo

We should print the err if clk_enable failed.

Signed-off-by: WEN Pingbo <pingbo.wen@linaro.org>
---
 drivers/input/serio/at32psif.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
index 2e4ff5b..aebb996 100644
--- a/drivers/input/serio/at32psif.c
+++ b/drivers/input/serio/at32psif.c
@@ -185,6 +185,7 @@ static void psif_set_prescaler(struct psif *psif)
 {
 	unsigned long prscv;
 	unsigned long rate = clk_get_rate(psif->pclk);
+	int retval;
 
 	/* PRSCV = Pulse length (100 us) * PSIF module frequency. */
 	prscv = 100 * (rate / 1000000UL);
@@ -195,7 +196,10 @@ static void psif_set_prescaler(struct psif *psif)
 				"prescaler set to max\n");
 	}
 
-	clk_enable(psif->pclk);
+	retval = clk_enable(psif->pclk);
+	if (retval < 0)
+		dev_err(&psif->pdev->dev,
+			"could not enable pclk, ret %d\n", retval);
 	psif_writel(psif, PSR, prscv);
 	clk_disable(psif->pclk);
 }
-- 
1.9.1


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

* [PATCH 2/2] Input: lpc32xx: handle clk_enable return value
  2015-09-11  3:02 [PATCH 1/2] Input: at32psif: handle clk_enable return value WEN Pingbo
@ 2015-09-11  3:02 ` WEN Pingbo
  2015-09-11  3:10 ` [PATCH 1/2] Input: at32psif: " Fabio Estevam
  1 sibling, 0 replies; 5+ messages in thread
From: WEN Pingbo @ 2015-09-11  3:02 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: broonie, linux-input, WEN Pingbo

If clk_enable failed, return the err code

Signed-off-by: WEN Pingbo <pingbo.wen@linaro.org>
---
 drivers/input/touchscreen/lpc32xx_ts.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c
index 24d704c..60cd31d 100644
--- a/drivers/input/touchscreen/lpc32xx_ts.c
+++ b/drivers/input/touchscreen/lpc32xx_ts.c
@@ -145,8 +145,14 @@ static void lpc32xx_stop_tsc(struct lpc32xx_tsc *tsc)
 static void lpc32xx_setup_tsc(struct lpc32xx_tsc *tsc)
 {
 	u32 tmp;
+	int retval;
 
-	clk_enable(tsc->clk);
+	retval = clk_enable(tsc->clk);
+	if (retval) {
+		dev_err(&tsc->dev->dev,
+			"clk_enable failed, ret %d\n", retval);
+		return;
+	}
 
 	tmp = tsc_readl(tsc, LPC32XX_TSC_CON) & ~LPC32XX_TSC_ADCCON_POWER_UP;
 
-- 
1.9.1


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

* Re: [PATCH 1/2] Input: at32psif: handle clk_enable return value
  2015-09-11  3:02 [PATCH 1/2] Input: at32psif: handle clk_enable return value WEN Pingbo
  2015-09-11  3:02 ` [PATCH 2/2] Input: lpc32xx: " WEN Pingbo
@ 2015-09-11  3:10 ` Fabio Estevam
  2015-09-11  3:21   ` Pingbo Wen
  2015-09-11  3:34   ` [PATCH V2 " WEN Pingbo
  1 sibling, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2015-09-11  3:10 UTC (permalink / raw)
  To: WEN Pingbo; +Cc: Dmitry Torokhov, Mark Brown, linux-input

On Fri, Sep 11, 2015 at 12:02 AM, WEN Pingbo <pingbo.wen@linaro.org> wrote:

> -       clk_enable(psif->pclk);
> +       retval = clk_enable(psif->pclk);
> +       if (retval < 0)
> +               dev_err(&psif->pdev->dev,
> +                       "could not enable pclk, ret %d\n", retval);

Shouldn't you add a 'return' here to prevent the code to proceed with
the failed clock?

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

* Re: [PATCH 1/2] Input: at32psif: handle clk_enable return value
  2015-09-11  3:10 ` [PATCH 1/2] Input: at32psif: " Fabio Estevam
@ 2015-09-11  3:21   ` Pingbo Wen
  2015-09-11  3:34   ` [PATCH V2 " WEN Pingbo
  1 sibling, 0 replies; 5+ messages in thread
From: Pingbo Wen @ 2015-09-11  3:21 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Dmitry Torokhov, Mark Brown, linux-input



On Friday, September 11, 2015 11:10 AM, Fabio Estevam wrote:
> On Fri, Sep 11, 2015 at 12:02 AM, WEN Pingbo <pingbo.wen@linaro.org> wrote:
>
>> -       clk_enable(psif->pclk);
>> +       retval = clk_enable(psif->pclk);
>> +       if (retval < 0)
>> +               dev_err(&psif->pdev->dev,
>> +                       "could not enable pclk, ret %d\n", retval);
> Shouldn't you add a 'return' here to prevent the code to proceed with
> the failed clock?
Yes, it should be there. I will re-send the patch. Thank you.

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

* [PATCH V2 1/2] Input: at32psif: handle clk_enable return value
  2015-09-11  3:10 ` [PATCH 1/2] Input: at32psif: " Fabio Estevam
  2015-09-11  3:21   ` Pingbo Wen
@ 2015-09-11  3:34   ` WEN Pingbo
  1 sibling, 0 replies; 5+ messages in thread
From: WEN Pingbo @ 2015-09-11  3:34 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: broonie, linux-input, WEN Pingbo

We should print the err if clk_enable failed.

Signed-off-by: WEN Pingbo <pingbo.wen@linaro.org>
---
 drivers/input/serio/at32psif.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
index 2e4ff5b..38862a8 100644
--- a/drivers/input/serio/at32psif.c
+++ b/drivers/input/serio/at32psif.c
@@ -185,6 +185,7 @@ static void psif_set_prescaler(struct psif *psif)
 {
 	unsigned long prscv;
 	unsigned long rate = clk_get_rate(psif->pclk);
+	int retval;
 
 	/* PRSCV = Pulse length (100 us) * PSIF module frequency. */
 	prscv = 100 * (rate / 1000000UL);
@@ -195,7 +196,12 @@ static void psif_set_prescaler(struct psif *psif)
 				"prescaler set to max\n");
 	}
 
-	clk_enable(psif->pclk);
+	retval = clk_enable(psif->pclk);
+	if (retval < 0) {
+		dev_err(&psif->pdev->dev,
+			"could not enable pclk, ret %d\n", retval);
+		return;
+	}
 	psif_writel(psif, PSR, prscv);
 	clk_disable(psif->pclk);
 }
-- 
1.9.1


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

end of thread, other threads:[~2015-09-11  3:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11  3:02 [PATCH 1/2] Input: at32psif: handle clk_enable return value WEN Pingbo
2015-09-11  3:02 ` [PATCH 2/2] Input: lpc32xx: " WEN Pingbo
2015-09-11  3:10 ` [PATCH 1/2] Input: at32psif: " Fabio Estevam
2015-09-11  3:21   ` Pingbo Wen
2015-09-11  3:34   ` [PATCH V2 " WEN Pingbo

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