scsi_cd: reset io_scheduler and dma_resource on uninit.
it seems possible that a file descriptor is still opened after the device is uninited. at least handle properly the situation. help with #15089 Change-Id: I76fb41a8439ab7350ce4d781511aceb6496847c3 Reviewed-on: https://review.haiku-os.org/c/1486 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
ff4af513e1
commit
061236d419
@@ -709,6 +709,8 @@ cd_uninit_device(void* _cookie)
|
|||||||
|
|
||||||
delete info->io_scheduler;
|
delete info->io_scheduler;
|
||||||
delete info->dma_resource;
|
delete info->dma_resource;
|
||||||
|
info->io_scheduler = NULL;
|
||||||
|
info->dma_resource = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -772,6 +774,9 @@ cd_read(void* cookie, off_t pos, void* buffer, size_t* _length)
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
if (handle->info->io_scheduler == NULL)
|
||||||
|
return B_DEV_NO_MEDIA;
|
||||||
|
|
||||||
status = handle->info->io_scheduler->ScheduleRequest(&request);
|
status = handle->info->io_scheduler->ScheduleRequest(&request);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -800,6 +805,9 @@ cd_write(void* cookie, off_t pos, const void* buffer, size_t* _length)
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
if (handle->info->io_scheduler == NULL)
|
||||||
|
return B_DEV_NO_MEDIA;
|
||||||
|
|
||||||
status = handle->info->io_scheduler->ScheduleRequest(&request);
|
status = handle->info->io_scheduler->ScheduleRequest(&request);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
Reference in New Issue
Block a user