intel_extreme: Fix tracking of device opens / closes
* Don't raise the open_count when the open fails
This commit is contained in:
@@ -124,9 +124,9 @@ device_open(const char* name, uint32 /*flags*/, void** _cookie)
|
|||||||
|
|
||||||
mutex_lock(&gLock);
|
mutex_lock(&gLock);
|
||||||
|
|
||||||
if (info->open_count++ == 0) {
|
if (info->open_count == 0) {
|
||||||
// this device has been opened for the first time, so
|
// This device hasn't been initialized yet, so we
|
||||||
// we allocate needed resources and initialize the structure
|
// allocate needed resources and initialize the structure
|
||||||
info->init_status = intel_extreme_init(*info);
|
info->init_status = intel_extreme_init(*info);
|
||||||
if (info->init_status == B_OK) {
|
if (info->init_status == B_OK) {
|
||||||
#ifdef DEBUG_COMMANDS
|
#ifdef DEBUG_COMMANDS
|
||||||
@@ -138,8 +138,11 @@ device_open(const char* name, uint32 /*flags*/, void** _cookie)
|
|||||||
|
|
||||||
mutex_unlock(&gLock);
|
mutex_unlock(&gLock);
|
||||||
|
|
||||||
if (info->init_status == B_OK)
|
if (info->init_status == B_OK) {
|
||||||
|
info->open_count++;
|
||||||
*_cookie = info;
|
*_cookie = info;
|
||||||
|
} else
|
||||||
|
ERROR("%s: initilization failed!\n", __func__);
|
||||||
|
|
||||||
return info->init_status;
|
return info->init_status;
|
||||||
}
|
}
|
||||||
@@ -171,7 +174,6 @@ device_free(void* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&gLock);
|
mutex_unlock(&gLock);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user