From 25fbe1eba777a1f93ccb045037194166cdfdecc0 Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Wed, 18 Apr 2018 15:20:03 +0800 Subject: [PATCH] MGS-3806: clocksource: tpm: make sure returning -ETIME case correct Incorrect condition check causes -ETIME return only happen when next event is equal to current counter, and it would cause various system issue like RCU stalls etc., the correct case should be whenever next event is less than current counter, -ETIME should be returned. Correct the type cast during return condition check to make it work right. Signed-off-by: Anson Huang Reviewed-by: Bai Ping --- 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 f1c87a27ec46..92001e5a4cef 100644 --- a/drivers/clocksource/timer-imx-tpm.c +++ b/drivers/clocksource/timer-imx-tpm.c @@ -105,7 +105,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.17.1