Skip to content

Commit

Permalink
alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP
Browse files Browse the repository at this point in the history
ENOTSUPP is not supposed to be returned to userspace. This was found on an
OpenPower machine, where the RTC does not support set_alarm.

On that system, a clock_nanosleep(CLOCK_REALTIME_ALARM, ...) results in
"524 Unknown error 524"

Replace it with EOPNOTSUPP which results in the expected "95 Operation not
supported" error.

Fixes: 1c6b39a (alarmtimers: Return -ENOTSUPP if no RTC device is present)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20190903171802.28314-1-cascardo@canonical.com
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and Thomas Gleixner committed Sep 5, 2019
1 parent 3b47fd5 commit f18ddc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/time/alarmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ static int alarm_timer_create(struct k_itimer *new_timer)
enum alarmtimer_type type;

if (!alarmtimer_get_rtcdev())
return -ENOTSUPP;
return -EOPNOTSUPP;

if (!capable(CAP_WAKE_ALARM))
return -EPERM;
Expand Down Expand Up @@ -790,7 +790,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
int ret = 0;

if (!alarmtimer_get_rtcdev())
return -ENOTSUPP;
return -EOPNOTSUPP;

if (flags & ~TIMER_ABSTIME)
return -EINVAL;
Expand Down

0 comments on commit f18ddc1

Please sign in to comment.