lkml.org 
[lkml]   [2018]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] clocksource: imx-tpm: correct -ETIME return condition check
Date
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
\
 
 \ /
  Last update: 2018-04-19 08:09    [W:0.043 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site