Commit e267f1e4 authored by Thadeu Lima de Souza Cascardo's avatar Thadeu Lima de Souza Cascardo Committed by Khalid Elmously

alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP

BugLink: https://bugs.launchpad.net/bugs/1848589

commit f18ddc13 upstream.

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: 1c6b39ad (alarmtimers: Return -ENOTSUPP if no RTC device is present)
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20190903171802.28314-1-cascardo@canonical.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent de5db582
...@@ -530,7 +530,7 @@ static int alarm_timer_create(struct k_itimer *new_timer) ...@@ -530,7 +530,7 @@ static int alarm_timer_create(struct k_itimer *new_timer)
struct alarm_base *base; struct alarm_base *base;
if (!alarmtimer_get_rtcdev()) if (!alarmtimer_get_rtcdev())
return -ENOTSUPP; return -EOPNOTSUPP;
if (!capable(CAP_WAKE_ALARM)) if (!capable(CAP_WAKE_ALARM))
return -EPERM; return -EPERM;
...@@ -759,7 +759,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags, ...@@ -759,7 +759,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
struct restart_block *restart; struct restart_block *restart;
if (!alarmtimer_get_rtcdev()) if (!alarmtimer_get_rtcdev())
return -ENOTSUPP; return -EOPNOTSUPP;
if (flags & ~TIMER_ABSTIME) if (flags & ~TIMER_ABSTIME)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment