diff options
author | John Stultz <john.stultz@linaro.org> | 2015-05-13 15:13:05 -0700 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2015-05-26 15:58:07 -0600 |
commit | 61171d0407b537eff299aea2388773b6c760e6eb (patch) | |
tree | 017ada2c9badb0e5026c49c5098cb1419a341804 /tools/testing/selftests/timers/alarmtimer-suspend.c | |
parent | acd5705d2d17a229b1aa0e549951ec66164b9379 (diff) | |
download | linux-61171d0407b537eff299aea2388773b6c760e6eb.tar.gz linux-61171d0407b537eff299aea2388773b6c760e6eb.tar.bz2 linux-61171d0407b537eff299aea2388773b6c760e6eb.zip |
kselftests: timers: Check _ALARM clockids are supported before suspending
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>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests/timers/alarmtimer-suspend.c')
-rw-r--r-- | tools/testing/selftests/timers/alarmtimer-suspend.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c index 13586b68ef51..72cacf5383dd 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), |