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:
@@ -123,12 +123,15 @@ device_open(const char* name, uint32 /*flags*/, void** _cookie)
|
||||
|
||||
mutex_lock(&gLock);
|
||||
|
||||
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
|
||||
info->init_status = radeon_hd_init(*info);
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user