diff --git a/sched/pthread/pthread_setschedparam.c b/sched/pthread/pthread_setschedparam.c index 3c04cfb0232..f5ce5c5391d 100644 --- a/sched/pthread/pthread_setschedparam.c +++ b/sched/pthread/pthread_setschedparam.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/pthread/pthread_setschedparam.c * - * Copyright (C) 2007, 2008, 2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2012, 2015, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -105,10 +106,6 @@ int pthread_setschedparam(pthread_t thread, int policy, sinfo("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); diff --git a/sched/sched/sched.h b/sched/sched/sched.h index eea2a3b1c2c..d083dc6a59d 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sched/sched.h * - * Copyright (C) 2007-2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -63,6 +63,10 @@ * tasks built into the design). */ +#if CONFIG_MAX_TASKS & (CONFIG_MAX_TASKS - 1) +# error CONFIG_MAX_TASKS must be power of 2 +#endif + #define MAX_TASKS_MASK (CONFIG_MAX_TASKS-1) #define PIDHASH(pid) ((pid) & MAX_TASKS_MASK) diff --git a/sched/semaphore/sem_recover.c b/sched/semaphore/sem_recover.c index bccb904e07b..6305f0d35e8 100644 --- a/sched/semaphore/sem_recover.c +++ b/sched/semaphore/sem_recover.c @@ -105,7 +105,7 @@ void nxsem_recover(FAR struct tcb_s *tcb) nxsem_canceled(tcb, sem); /* And increment the count on the semaphore. This releases the count - * that was taken by sem_post(). This count decremented the semaphore + * that was taken by sem_wait(). This count decremented the semaphore * count to negative and caused the thread to be blocked in the first * place. */ diff --git a/sched/task/task_create.c b/sched/task/task_create.c index a1d07e1d8ec..2cc8c1a9118 100644 --- a/sched/task/task_create.c +++ b/sched/task/task_create.c @@ -103,11 +103,11 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, goto errout; } +#ifdef HAVE_TASK_GROUP /* Allocate a new task group with privileges appropriate for the parent * thread type. */ -#ifdef HAVE_TASK_GROUP ret = group_allocate(tcb, ttype); if (ret < 0) { @@ -157,9 +157,9 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority, (void)task_argsetup(tcb, name, argv); +#ifdef HAVE_TASK_GROUP /* Now we have enough in place that we can join the group */ -#ifdef HAVE_TASK_GROUP ret = group_initialize(tcb); if (ret < 0) { diff --git a/sched/task/task_setcanceltype.c b/sched/task/task_setcanceltype.c index b7536f46258..3c08c5d3206 100644 --- a/sched/task/task_setcanceltype.c +++ b/sched/task/task_setcanceltype.c @@ -52,7 +52,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: task_setcancelstate + * Name: task_setcanceltype * * Description: * The task_setcanceltype() function atomically both sets the calling diff --git a/sched/wdog/wd_delete.c b/sched/wdog/wd_delete.c index a497c1146e0..7b56bede466 100644 --- a/sched/wdog/wd_delete.c +++ b/sched/wdog/wd_delete.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/wdog/wd_delete.c * - * Copyright (C) 2007-2009, 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2014, 2016, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -113,9 +114,7 @@ int wd_delete(WDOG_ID wdog) sched_kfree(wdog); } - /* This was a pre-allocated timer. This function should not be called for - * statically allocated timers. - */ + /* Check if this is pre-allocated timer. */ else if (!WDOG_ISSTATIC(wdog)) { @@ -129,6 +128,13 @@ int wd_delete(WDOG_ID wdog) leave_critical_section(flags); } + /* This function should not be called for statically allocated timers. */ + + else + { + leave_critical_section(flags); + } + /* Return success */ return OK;