Skip to content

Commit

Permalink
posix: pthread: Reuse variable for return code
Browse files Browse the repository at this point in the history
No need to have different variables for different function's return
codes.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information
finikorg authored and fabiobaltieri committed Oct 3, 2023
1 parent 0ee0380 commit 06e8e9f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/posix/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,8 @@ void pthread_exit(void *retval)
*/
int pthread_join(pthread_t pthread, void **status)
{
int err;
int ret;
struct posix_thread *t;
int ret;

if (pthread == pthread_self()) {
LOG_ERR("Pthread attempted to join itself (%x)", pthread);
Expand Down Expand Up @@ -694,9 +693,9 @@ int pthread_join(pthread_t pthread, void **status)
break;
}

err = k_thread_join(&t->thread, K_FOREVER);
ret = k_thread_join(&t->thread, K_FOREVER);
/* other possibilities? */
__ASSERT_NO_MSG(err == 0);
__ASSERT_NO_MSG(ret == 0);

LOG_DBG("Joined pthread %p", &t->thread);

Expand Down

0 comments on commit 06e8e9f

Please sign in to comment.