pthread_mutexattr_setprotocol: remove the unreached dead code

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
guoshichao 2024-09-09 14:57:54 +08:00 committed by Xiang Xiao
parent c9223469d4
commit 3e66184f23

View file

@ -54,38 +54,33 @@ int pthread_mutexattr_setprotocol(FAR pthread_mutexattr_t *attr,
linfo("attr=%p protocol=%d\n", attr, protocol);
DEBUGASSERT(attr != NULL);
if (protocol >= PTHREAD_PRIO_NONE && protocol <= PTHREAD_PRIO_PROTECT)
switch (protocol)
{
switch (protocol)
{
case PTHREAD_PRIO_NONE:
case PTHREAD_PRIO_NONE:
#if defined(CONFIG_PRIORITY_INHERITANCE) || defined(CONFIG_PRIORITY_PROTECT)
attr->proto = PTHREAD_PRIO_INHERIT;
attr->proto = PTHREAD_PRIO_INHERIT;
#endif
break;
break;
case PTHREAD_PRIO_INHERIT:
case PTHREAD_PRIO_INHERIT:
#ifdef CONFIG_PRIORITY_INHERITANCE
attr->proto = PTHREAD_PRIO_INHERIT;
break;
attr->proto = PTHREAD_PRIO_INHERIT;
break;
#else
return ENOTSUP;
return ENOTSUP;
#endif /* CONFIG_PRIORITY_INHERITANCE */
case PTHREAD_PRIO_PROTECT:
case PTHREAD_PRIO_PROTECT:
#ifdef CONFIG_PRIORITY_PROTECT
attr->proto = PTHREAD_PRIO_PROTECT;
break;
attr->proto = PTHREAD_PRIO_PROTECT;
break;
#else
return ENOTSUP;
return ENOTSUP;
#endif /* CONFIG_PRIORITY_PROTECT */
default:
return ENOTSUP;
}
return OK;
default:
return EINVAL;
}
return EINVAL;
return OK;
}