From: pradeep.ns Date: Fri, 18 Aug 2017 19:11:04 +0000 (+0530) Subject: Remove failsafe error setting in pthread_setschedparam.c X-Git-Tag: 1.1_Public_Release~340^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96bc4500294f2e8aaa6dc9dcb45d71cf4084afd6;p=rtos%2Ftinyara.git Remove failsafe error setting in pthread_setschedparam.c Setting the error no at the beginning of logic is not a good practice as it causes confusion during successful execution of the API. When API executes successfully, it does not revert the wrong error code set during beginning of the logic. Thus we should always make a practice to set the error no only when logic enters the error case. Signed-off-by: pradeep.ns --- diff --git a/os/kernel/pthread/pthread_setschedparam.c b/os/kernel/pthread/pthread_setschedparam.c index 883c391..ec20ee0 100644 --- a/os/kernel/pthread/pthread_setschedparam.c +++ b/os/kernel/pthread/pthread_setschedparam.c @@ -141,10 +141,6 @@ int pthread_setschedparam(pthread_t thread, int policy, FAR const struct sched_p svdbg("thread ID=%d policy=%d param=0x%p\n", thread, policy, param); - /* Set the errno to some non-zero value (failsafe) */ - - set_errno(EINVAL); - /* Let sched_setscheduler do all of the work */ ret = sched_setscheduler((pid_t)thread, policy, param);