All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: John Stultz <john.stultz@linaro.org>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Prarit Bhargava <prarit@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Cochran <richardcochran@gmail.com>
Subject: [PATCH 3/3] kselftests: timers: Check _ALARM clockids are supported before suspending
Date: Wed, 13 May 2015 15:13:05 -0700	[thread overview]
Message-ID: <1431555185-10182-4-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1431555185-10182-1-git-send-email-john.stultz@linaro.org>

It was reported that the alarmtimer-suspend test hangs on older
systems that don't support _ALARM clockids.

This is due to the fact that we don't check if the timer_create
fails, and thus when we suspend, the system will not programatically
resume.

Fix this by checking the timer_create call for errors.

Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 tools/testing/selftests/timers/alarmtimer-suspend.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c
index 13586b6..72cacf5 100644
--- a/tools/testing/selftests/timers/alarmtimer-suspend.c
+++ b/tools/testing/selftests/timers/alarmtimer-suspend.c
@@ -152,7 +152,11 @@ int main(void)
 			alarm_clock_id++) {
 
 		alarmcount = 0;
-		timer_create(alarm_clock_id, &se, &tm1);
+		if (timer_create(alarm_clock_id, &se, &tm1) == -1) {
+			printf("timer_create failled, %s unspported?\n",
+					clockstring(alarm_clock_id));
+			break;
+		}
 
 		clock_gettime(alarm_clock_id, &start_time);
 		printf("Start time (%s): %ld:%ld\n", clockstring(alarm_clock_id),
-- 
1.9.1


  parent reply	other threads:[~2015-05-13 22:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 22:13 [PATCH 0/3] A few small fixups to the alarmtimer-suspend test John Stultz
2015-05-13 22:13 ` [PATCH 1/3] kselftests: timers: Increase delay between suspends in alarmtimer-suspend John Stultz
2015-05-13 22:13 ` [PATCH 2/3] kselftests: timers: Ease alarmtimer-suspend unreasonable latency value John Stultz
2015-05-13 22:13 ` John Stultz [this message]
2015-05-13 23:04 ` [PATCH 0/3] A few small fixups to the alarmtimer-suspend test Shuah Khan
2015-05-13 23:16   ` John Stultz
2015-05-13 23:18     ` Shuah Khan
2015-05-14  0:39     ` Shuah Khan

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=1431555185-10182-4-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=shuahkh@osg.samsung.com \
    --cc=tglx@linutronix.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.