Hi,
As Marcus Brinkmann asked, here is the patch against ath_mutex_destroy().
New function code:
======================== 8< ================================
int
ath_mutex_destroy (ath_mutex_t *lock)
{
int err;
if (!ops_set || !ops.mutex_destroy)
return 0;
/* if mutex isn't initialiased, just exit */
(*ops.mutex_lock) (&check_init_lock);
if (*lock == ATH_MUTEX_INITIALIZER) {
(*ops.mutex_unlock) (&check_init_lock);
return 0;
}
(*ops.mutex_unlock) (&check_init_lock);
err = (*ops.mutex_destroy) (lock);
#ifndef NDEBUG
assert (*lock == MUTEX_UNLOCKED);
*lock = MUTEX_DESTROYED;
#endif
return err;
}
======================== 8< ================================
Main change: if the lock is not initialized, just skip the function.
Victor Stinner
As Marcus Brinkmann asked, here is the patch against ath_mutex_destroy().
New function code:
======================== 8< ================================
int
ath_mutex_destroy (ath_mutex_t *lock)
{
int err;
if (!ops_set || !ops.mutex_destroy)
return 0;
/* if mutex isn't initialiased, just exit */
(*ops.mutex_lock) (&check_init_lock);
if (*lock == ATH_MUTEX_INITIALIZER) {
(*ops.mutex_unlock) (&check_init_lock);
return 0;
}
(*ops.mutex_unlock) (&check_init_lock);
err = (*ops.mutex_destroy) (lock);
#ifndef NDEBUG
assert (*lock == MUTEX_UNLOCKED);
*lock = MUTEX_DESTROYED;
#endif
return err;
}
======================== 8< ================================
Main change: if the lock is not initialized, just skip the function.
Victor Stinner