vesa: Fix tracking of device opens / closes
* Don't raise the open_count when the open fails
This commit is contained in:
parent
3347bc1431
commit
87784cafb8
@ -51,13 +51,12 @@ device_open(const char* name, uint32 flags, void** _cookie)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
vesa_info* info = gDeviceInfo[id];
|
||||
*_cookie = info;
|
||||
|
||||
mutex_lock(&gLock);
|
||||
|
||||
status_t status = B_OK;
|
||||
|
||||
if (info->open_count++ == 0) {
|
||||
if (info->open_count == 0) {
|
||||
// this device has been opened for the first time, so
|
||||
// we allocate needed resources and initialize the structure
|
||||
if (status == B_OK)
|
||||
@ -66,6 +65,11 @@ device_open(const char* name, uint32 flags, void** _cookie)
|
||||
info->id = id;
|
||||
}
|
||||
|
||||
if (status == B_OK) {
|
||||
info->open_count++;
|
||||
*_cookie = info;
|
||||
}
|
||||
|
||||
mutex_unlock(&gLock);
|
||||
return status;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user