Return-Path: From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Miroslav Lichvar , Thomas Gleixner , Ingo Molnar , Richard Cochran , Prarit Bhargava , Stephen Boyd , Shuah Khan , John Stultz , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 059/162] kselftests: timers: Fix inconsistency-check to not ignore first timestamp Date: Mon, 9 Apr 2018 00:28:25 +0000 Message-ID: <20180409002738.163941-59-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: From: Miroslav Lichvar [ Upstream commit 7a5de5512296fd2ab7a497e4a576196b1f046e78 ] When the first timestamp in the list of clock readings was later than the second timestamp and all other timestamps were in order, the inconsistency was not reported because the index of the out-of-order timestamp was equal to the default value. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Stephen Boyd Cc: Shuah Khan Signed-off-by: Miroslav Lichvar Signed-off-by: John Stultz Signed-off-by: Sasha Levin --- tools/testing/selftests/timers/inconsistency-check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/timers/inconsistency-check.c b/tools/t= esting/selftests/timers/inconsistency-check.c index caf1bc9257c4..74c60e8759a0 100644 --- a/tools/testing/selftests/timers/inconsistency-check.c +++ b/tools/testing/selftests/timers/inconsistency-check.c @@ -118,7 +118,7 @@ int consistency_test(int clock_type, unsigned long seco= nds) start_str =3D ctime(&t); =20 while (seconds =3D=3D -1 || now - then < seconds) { - inconsistent =3D 0; + inconsistent =3D -1; =20 /* Fill list */ for (i =3D 0; i < CALLS_PER_LOOP; i++) @@ -130,7 +130,7 @@ int consistency_test(int clock_type, unsigned long seco= nds) inconsistent =3D i; =20 /* display inconsistency */ - if (inconsistent) { + if (inconsistent >=3D 0) { unsigned long long delta; =20 printf("\%s\n", start_str); --=20 2.15.1