From: Vidisha Thapa Date: Fri, 21 Jul 2017 09:30:09 +0000 (+0530) Subject: Libc/pthread: Fix return type of pthread_mutexattr_getprotocol X-Git-Tag: 1.1_Public_Release~393^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19b76fe9d1aa9621a227bc979be639f6f60b0f3f;p=rtos%2Ftinyara.git Libc/pthread: Fix return type of pthread_mutexattr_getprotocol Upon successful completion, pthread_mutexattr_getprotocol() shall return 0; otherwise, an error number shall be returned to indicate the error. pthread_mutexattr_getprotocol was returning the protocol rather than 0. Signed-off-by: Vidisha Thapa --- diff --git a/lib/libc/pthread/pthread_mutexattr_getprotocol.c b/lib/libc/pthread/pthread_mutexattr_getprotocol.c index a923fb5..6218ea7 100644 --- a/lib/libc/pthread/pthread_mutexattr_getprotocol.c +++ b/lib/libc/pthread/pthread_mutexattr_getprotocol.c @@ -59,6 +59,7 @@ #include #include #include +#include /**************************************************************************** * Public Functions @@ -80,16 +81,18 @@ * ****************************************************************************/ -int pthread_mutexattr_getprotocol(FAR const pthread_mutexattr_t *attr, - FAR int *protocol) +int pthread_mutexattr_getprotocol(FAR const pthread_mutexattr_t *attr, FAR int *protocol) { - DEBUGASSERT(attr != NULL && protocol != NULL); - + if (attr != NULL && protocol != NULL) { #ifdef CONFIG_PRIORITY_INHERITANCE - svdbg("Returning %d\n", attr->proto); - return attr->proto; + svdbg("Returning %d\n", attr->proto); + *protocol = attr->proto; #else - svdbg("Returning %d\n", PTHREAD_PRIO_NONE); - return PTHREAD_PRIO_NONE; + svdbg("Returning %d\n", PTHREAD_PRIO_NONE); + *protocol = PTHREAD_PRIO_NONE; #endif + return 0; + } + + return EINVAL; }