put modules on error

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22259 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2007-09-19 21:44:40 +00:00
parent ef317e11d4
commit 5d7f50f66c
3 changed files with 12 additions and 3 deletions
@@ -131,8 +131,10 @@ init_driver(void)
} }
status = init_lock(&gLock, "intel extreme ksync"); status = init_lock(&gLock, "intel extreme ksync");
if (status < B_OK) if (status < B_OK) {
put_module(B_PCI_MODULE_NAME);
return status; return status;
}
// find devices // find devices
@@ -155,6 +155,8 @@ status_t init_driver( void )
devices = (radeon_devices *)calloc( 1, sizeof( radeon_devices )); devices = (radeon_devices *)calloc( 1, sizeof( radeon_devices ));
if( devices == NULL ) { if( devices == NULL ) {
put_module(B_PCI_MODULE_NAME); put_module(B_PCI_MODULE_NAME);
if (agp_bus != NULL)
put_module(B_AGP_MODULE_NAME);
return B_ERROR; return B_ERROR;
} }
@@ -177,7 +179,8 @@ void uninit_driver( void )
put_module( B_PCI_MODULE_NAME ); put_module( B_PCI_MODULE_NAME );
/* put the agp module away if it's there */ /* put the agp module away if it's there */
if (agp_bus) put_module(B_AGP_MODULE_NAME); if (agp_bus)
put_module(B_AGP_MODULE_NAME);
} }
@@ -284,6 +284,9 @@ init_driver(void) {
/* driver private data */ /* driver private data */
pd = (DeviceData *)calloc(1, sizeof(DeviceData)); pd = (DeviceData *)calloc(1, sizeof(DeviceData));
if (!pd) { if (!pd) {
if (agp_bus)
put_module(B_AGP_MODULE_NAME);
put_module(B_ISA_MODULE_NAME);
put_module(B_PCI_MODULE_NAME); put_module(B_PCI_MODULE_NAME);
return B_ERROR; return B_ERROR;
} }
@@ -324,7 +327,8 @@ void uninit_driver(void) {
put_module(B_ISA_MODULE_NAME); put_module(B_ISA_MODULE_NAME);
/* put the agp module away if it's there */ /* put the agp module away if it's there */
if (agp_bus) put_module(B_AGP_MODULE_NAME); if (agp_bus)
put_module(B_AGP_MODULE_NAME);
} }
static status_t map_device(device_info *di) static status_t map_device(device_info *di)