LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: tip-bot for Anson Huang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, hpa@zytor.com, Anson.Huang@nxp.com,
	linux-kernel@vger.kernel.org, Aisheng.dong@nxp.com,
	mingo@kernel.org
Subject: [tip:timers/urgent] clocksource/imx-tpm: Correct -ETIME return condition check
Date: Thu, 19 Apr 2018 04:25:13 -0700	[thread overview]
Message-ID: <tip-7407188489c62a7b5694bc75a6db2b82af94c9a5@git.kernel.org> (raw)
In-Reply-To: <1524117883-2484-1-git-send-email-Anson.Huang@nxp.com>

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)

      parent reply	other threads:[~2018-04-19 11:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19  6:04 [PATCH] clocksource: imx-tpm: correct " Anson Huang
2018-04-19  7:14 ` A.s. Dong
2018-04-19 11:25 ` tip-bot for Anson Huang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-7407188489c62a7b5694bc75a6db2b82af94c9a5@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=Aisheng.dong@nxp.com \
    --cc=Anson.Huang@nxp.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --subject='Re: [tip:timers/urgent] clocksource/imx-tpm: Correct -ETIME return condition check' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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