nvme: sync up unit test nvme_impl.h mutex wrapper

The default version of nvme_impl.h was cleaned up to release the pthread
mutex attr on failure cases, but the unit test version did not receive
this update.

Change-Id: I899b7dc809393dc8e6fd24ed98e1d0a61ecf1c95
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-09-30 16:18:18 -07:00
parent 2bec440057
commit cac5caec8b

View File

@ -101,14 +101,17 @@ static inline int
nvme_mutex_init_recursive(nvme_mutex_t *mtx)
{
pthread_mutexattr_t attr;
int rc = 0;
if (pthread_mutexattr_init(&attr)) {
return -1;
}
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) {
return -1;
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) ||
pthread_mutex_init(mtx, &attr)) {
rc = -1;
}
return pthread_mutex_init(mtx, &attr);
pthread_mutexattr_destroy(&attr);
return rc;
}
/**