clocksource: imx-tpm: correct -ETIME return condition check
Subsystems (2)
PATCH 1/1 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.
---
resend, since I got failure message of sending mail to [email protected].
drivers/clocksource/timer-imx-tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-imx-tpm.c +1 -1
@@ -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)
Signature · 1 line
2.7.4
Quoted 9 lines
-----Original Message-----
From: Anson Huang
Sent: Thursday, April 19, 2018 2:05 PM
To: [email protected]; [email protected]; linux- [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: [PATCH] clocksource: imx-tpm: correct-ETIMEreturn condition check
Quoted 8 lines
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_eventalways returns correct value.Signed-off-by Anson Huang <[email protected]>
It's my mistake. Thanks for spotting it out.
Regards
Dong Aisheng
Quoted 22 lines
---
resend, since I got failure message of sending mail to linux-
[email protected].drivers/clocksource/timer-imx-tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clocksource/timer- renamed from drivers/clocksource/timer-imx-tpm.c +0
-0
imx-tpm.c
index 05d97a6..6c83184 100644drivers/clocksource/timer-imx-tpm.c +1
-2@@ -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
tip-bot for Anson Huang
merge bot[tip:timers/urgent] clocksource/imx-tpm: Correct -ETIME return condition check
In reply to Anson Huangclocksource/imx-tpm: Correct -ETIME return condition check
Commit-ID: 7407188489c62a7b5694bc75a6db2b82af94c9a5 Gitweb: https://git.kernel.org/tip/7407188489c62a7b5694bc75a6db2b82af94c9a5 Author: Anson Huang <[email protected]> AuthorDate: Thu, 19 Apr 2018 14:04:43 +0800 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/clocksource/timer-imx-tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-imx-tpm.c +1 -1
@@ -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)