On Tue, Apr 29, 2025 at 8:27 PM Su Hui <suhui@xxxxxxxxxxxx> wrote: > > 'clockid' only can be ALARM_REALTIME and ALARM_BOOTTIME. It's impossible > to return -1 and callers never check the value of -1. > > Only alarm_clock_get_timespec(), alarm_clock_get_ktime(), > alarm_timer_create() and alarm_timer_nsleep() call clock2alarm(). These > callers using clockid_to_kclock() to get 'struct k_clock', this ensures > clock2alarm() never returns -1. > > Remove the impossible -1 return value, and add a warn to be aware of any > misuse of this function. > > Signed-off-by: Su Hui <suhui@xxxxxxxxxxxx> Acked-by: John Stultz <jstultz@xxxxxxxxxx>