does no longer crash, calles attach and detach

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7108 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2004-03-29 23:15:02 +00:00
parent 0dac193921
commit 0b67beb4a1
2 changed files with 5 additions and 6 deletions
@@ -20,7 +20,6 @@ KernelLd ichaudio :
-Bdynamic -shared
:
:
add-ons/kernel/drivers/bin
;
SubInclude OBOS_TOP src add-ons kernel drivers audio ac97 ichaudio lala ;
@@ -129,12 +129,12 @@ ich_open(const char *name, uint32 flags, void** cookie)
}
*cookie = (void *) index;
if (drv_data[drv_count]->open_count == 0) {
if (drv_data[index]->open_count == 0) {
res = driver_info.attach(drv_data[index], &drv_data[index]->cookie);
drv_data[drv_count]->open_count = (res == B_OK) ? 1 : 0;
drv_data[index]->open_count = (res == B_OK) ? 1 : 0;
} else {
res = B_OK;
drv_data[drv_count]->open_count++;
drv_data[index]->open_count++;
}
release_sem(drv_sem);
@@ -161,9 +161,9 @@ ich_free(void* cookie)
acquire_sem(drv_sem);
drv_data[drv_count]->open_count--;
drv_data[index]->open_count--;
if (drv_data[drv_count]->open_count == 0)
if (drv_data[index]->open_count == 0)
res = driver_info.detach(drv_data[index], drv_data[index]->cookie);
else
res = B_OK;