Ignore:
Timestamp:
Aug 26, 2018, 7:24:25 PM (6 years ago)
Author:
viala@…
Message:

[process] fix undefined/declared variable in process_register_thread.

We made a typo.

Found with GCC:

kern/process.c: In function 'process_register_thread':
kern/process.c:1054:7: warning: 'type' may be used uninitialized in this function [-Wmaybe-uninitialized]

if( type == THREAD_IDLE ) spinlock_lock_busy( &process->th_lock , &save_sr );

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/process.c

    r503 r514  
    10411041{
    10421042    ltid_t         ltid;
    1043     thread_type_t  type;
    10441043    reg_t          save_sr;
    10451044    bool_t         found = false;
     
    10521051    // take lock protecting th_tbl, depending on thread type:
    10531052    // we don't want to use a descheduling policy for idle thread initialisation
    1054     if( type == THREAD_IDLE )  spinlock_lock_busy( &process->th_lock , &save_sr );
    1055     else                       spinlock_lock( &process->th_lock );
     1053    if ( thread->type == THREAD_IDLE ) {
     1054        spinlock_lock_busy( &process->th_lock , &save_sr );
     1055    } else {
     1056        spinlock_lock( &process->th_lock );
     1057    }
    10561058
    10571059    // search a free slot in th_tbl[]
     
    10771079    // release lock protecting th_tbl
    10781080    hal_fence();
    1079     if( type == THREAD_IDLE )  spinlock_unlock_busy( &process->th_lock , save_sr );
    1080     else                       spinlock_unlock( &process->th_lock );
     1081    if( thread->type == THREAD_IDLE ) {
     1082        spinlock_unlock_busy( &process->th_lock , save_sr );
     1083    } else {
     1084        spinlock_unlock( &process->th_lock );
     1085    }
    10811086
    10821087    return (found) ? 0 : ENOMEM;
Note: See TracChangeset for help on using the changeset viewer.