posix: pthread_getspecific: fix for coverity issue cid 334909
* remove unneeded line of code that duplicated the first part of the SYS_SLIST_FOR_EACH_NODE() expansion. * return NULL if pthread_self() is not a valid pthread Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
parent
c48d61a4b4
commit
3458527a2c
@ -248,12 +248,17 @@ out:
|
||||
void *pthread_getspecific(pthread_key_t key)
|
||||
{
|
||||
pthread_key_obj *key_obj;
|
||||
struct posix_thread *thread = to_posix_thread(pthread_self());
|
||||
struct posix_thread *thread;
|
||||
pthread_thread_data *thread_spec_data;
|
||||
void *value = NULL;
|
||||
sys_snode_t *node_l;
|
||||
k_spinlock_key_t key_key;
|
||||
|
||||
thread = to_posix_thread(pthread_self());
|
||||
if (thread == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
key_key = k_spin_lock(&pthread_key_lock);
|
||||
|
||||
key_obj = get_posix_key(key);
|
||||
@ -262,8 +267,6 @@ void *pthread_getspecific(pthread_key_t key)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node_l = sys_slist_peek_head(&(thread->key_list));
|
||||
|
||||
/* Traverse the list of keys set by the thread, looking for key */
|
||||
|
||||
SYS_SLIST_FOR_EACH_NODE(&(thread->key_list), node_l) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user