radeon_hd: Fix crash of driver on multiple open

* open_count only got raised on initial open,
  subsequent opens didn't increment the counter
  thus when they exited the driver unloaded
  causing app_server to crash
* Thanks to hamishm for pointing out that
  the if checks the pre-increment number
* Resolves #10452
* Add a kdl debug command to radeon_hd
This commit is contained in:
Alexander von Gluck IV
2014-01-20 20:51:46 -06:00
parent 701a5d6b79
commit 7b59f29e9e
@@ -123,12 +123,15 @@ 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 has been opened for the first time, so
// we allocate needed resources and initialize the structure // we allocate needed resources and initialize the structure
info->init_status = radeon_hd_init(*info); info->init_status = radeon_hd_init(*info);
if (info->init_status == B_OK) { if (info->init_status == B_OK) {
info->open_count++; #ifdef DEBUG_COMMANDS
add_debugger_command("radeonhd_reg", getset_register,
"dumps or sets the specified radeon_hd register");
#endif
} }
} }