linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: imx-tpm: correct -ETIME return condition check
@ 2018-04-19  6:04 Anson Huang
  2018-04-19  7:14 ` A.s. Dong
  2018-04-19 11:25 ` [tip:timers/urgent] clocksource/imx-tpm: Correct " tip-bot for Anson Huang
  0 siblings, 2 replies; 3+ messages in thread
From: Anson Huang @ 2018-04-19  6:04 UTC (permalink / raw)
  To: daniel.lezcano, tglx, linux-kernel; +Cc: Linux-imx

The additional brakets added to tpm_set_next_event's return
value computation causes (int) forced type conversion NOT
taking effect, and the incorrect value return will cause
various system timer issue, like RCU stall etc..

This patch removes the additional brakets to make sure
tpm_set_next_event always returns correct value.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
	resend, since I got failure message of sending mail to linux-kernel@vger.kernel.org.
 drivers/clocksource/timer-imx-tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-imx-tpm.c
index 05d97a6..6c83184 100644
--- a/drivers/clocksource/timer-imx-tpm.c
+++ b/drivers/clocksource/timer-imx-tpm.c
@@ -114,7 +114,7 @@ static int tpm_set_next_event(unsigned long delta,
 	 * of writing CNT registers which may cause the min_delta event got
 	 * missed, so we need add a ETIME check here in case it happened.
 	 */
-	return (int)((next - now) <= 0) ? -ETIME : 0;
+	return (int)(next - now) <= 0 ? -ETIME : 0;
 }
 
 static int tpm_set_state_oneshot(struct clock_event_device *evt)
-- 
2.7.4

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

* RE: [PATCH] clocksource: imx-tpm: correct -ETIME return condition check
  2018-04-19  6:04 [PATCH] clocksource: imx-tpm: correct -ETIME return condition check Anson Huang
@ 2018-04-19  7:14 ` A.s. Dong
  2018-04-19 11:25 ` [tip:timers/urgent] clocksource/imx-tpm: Correct " tip-bot for Anson Huang
  1 sibling, 0 replies; 3+ messages in thread
From: A.s. Dong @ 2018-04-19  7:14 UTC (permalink / raw)
  To: Anson Huang, daniel.lezcano, tglx, linux-kernel; +Cc: dl-linux-imx

> -----Original Message-----
> From: Anson Huang
> Sent: Thursday, April 19, 2018 2:05 PM
> To: daniel.lezcano@linaro.org; tglx@linutronix.de; linux-
> kernel@vger.kernel.org
> Cc: dl-linux-imx <linux-imx@nxp.com>
> Subject: [PATCH] clocksource: imx-tpm: correct -ETIME return condition
> check
> 
> The additional brakets added to tpm_set_next_event's return value
> computation causes (int) forced type conversion NOT taking effect, and the
> incorrect value return will cause various system timer issue, like RCU stall etc..
> 
> This patch removes the additional brakets to make sure
> tpm_set_next_event always returns correct value.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

It's my mistake. Thanks for spotting it out.

Acked-by: Dong Aisheng <Aisheng.dong@nxp.com>

Regards
Dong Aisheng

> ---
> 	resend, since I got failure message of sending mail to linux-
> kernel@vger.kernel.org.
>  drivers/clocksource/timer-imx-tpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-
> imx-tpm.c
> index 05d97a6..6c83184 100644
> --- a/drivers/clocksource/timer-imx-tpm.c
> +++ b/drivers/clocksource/timer-imx-tpm.c
> @@ -114,7 +114,7 @@ static int tpm_set_next_event(unsigned long delta,
>  	 * of writing CNT registers which may cause the min_delta event got
>  	 * missed, so we need add a ETIME check here in case it happened.
>  	 */
> -	return (int)((next - now) <= 0) ? -ETIME : 0;
> +	return (int)(next - now) <= 0 ? -ETIME : 0;
>  }
> 
>  static int tpm_set_state_oneshot(struct clock_event_device *evt)
> --
> 2.7.4

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

* [tip:timers/urgent] clocksource/imx-tpm: Correct -ETIME return condition check
  2018-04-19  6:04 [PATCH] clocksource: imx-tpm: correct -ETIME return condition check Anson Huang
  2018-04-19  7:14 ` A.s. Dong
@ 2018-04-19 11:25 ` tip-bot for Anson Huang
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Anson Huang @ 2018-04-19 11:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, hpa, Anson.Huang, linux-kernel, Aisheng.dong, mingo

Commit-ID:  7407188489c62a7b5694bc75a6db2b82af94c9a5
Gitweb:     https://git.kernel.org/tip/7407188489c62a7b5694bc75a6db2b82af94c9a5
Author:     Anson Huang <Anson.Huang@nxp.com>
AuthorDate: Thu, 19 Apr 2018 14:04:43 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 19 Apr 2018 13:21:35 +0200

clocksource/imx-tpm: Correct -ETIME return condition check

The additional brakects added to tpm_set_next_event's return value
computation causes (int) forced type conversion NOT taking effect, and the
incorrect value return will cause various system timer issue, like RCU
stall etc..

Remove the additional brackets to make sure tpm_set_next_event always
returns correct value.

Fixes: 059ab7b82eec ("clocksource/drivers/imx-tpm: Add imx tpm timer support")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Dong Aisheng <Aisheng.dong@nxp.com>
Cc: stable@vger.kernel.org
Cc: daniel.lezcano@linaro.org
Cc: Linux-imx@nxp.com
Link: https://lkml.kernel.org/r/1524117883-2484-1-git-send-email-Anson.Huang@nxp.com
---
 drivers/clocksource/timer-imx-tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-imx-tpm.c
index 05d97a6871d8..6c8318470b48 100644
--- a/drivers/clocksource/timer-imx-tpm.c
+++ b/drivers/clocksource/timer-imx-tpm.c
@@ -114,7 +114,7 @@ static int tpm_set_next_event(unsigned long delta,
 	 * of writing CNT registers which may cause the min_delta event got
 	 * missed, so we need add a ETIME check here in case it happened.
 	 */
-	return (int)((next - now) <= 0) ? -ETIME : 0;
+	return (int)(next - now) <= 0 ? -ETIME : 0;
 }
 
 static int tpm_set_state_oneshot(struct clock_event_device *evt)

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

end of thread, other threads:[~2018-04-19 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19  6:04 [PATCH] clocksource: imx-tpm: correct -ETIME return condition check Anson Huang
2018-04-19  7:14 ` A.s. Dong
2018-04-19 11:25 ` [tip:timers/urgent] clocksource/imx-tpm: Correct " tip-bot for Anson Huang

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