From 3347bc1431a542f12dbd8d9c9c6ac0285aa68768 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 27 Jan 2014 21:03:47 +0000 Subject: [PATCH] intel_extreme: Fix tracking of device opens / closes * Don't raise the open_count when the open fails --- .../kernel/drivers/graphics/intel_extreme/device.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp index 0b981f1d14..df8872bd36 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp @@ -124,9 +124,9 @@ device_open(const char* name, uint32 /*flags*/, void** _cookie) mutex_lock(&gLock); - if (info->open_count++ == 0) { - // this device has been opened for the first time, so - // we allocate needed resources and initialize the structure + if (info->open_count == 0) { + // This device hasn't been initialized yet, so we + // allocate needed resources and initialize the structure info->init_status = intel_extreme_init(*info); if (info->init_status == B_OK) { #ifdef DEBUG_COMMANDS @@ -138,8 +138,11 @@ device_open(const char* name, uint32 /*flags*/, void** _cookie) mutex_unlock(&gLock); - if (info->init_status == B_OK) + if (info->init_status == B_OK) { + info->open_count++; *_cookie = info; + } else + ERROR("%s: initilization failed!\n", __func__); return info->init_status; } @@ -171,7 +174,6 @@ device_free(void* data) } mutex_unlock(&gLock); - return B_OK; }