free ressources on error or uninit
for vmware, actually checks if the device was found git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22260 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -100,6 +100,7 @@ init_driver(void)
|
|||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
|
free(gDeviceNames[0]);
|
||||||
put_module(B_ISA_MODULE_NAME);
|
put_module(B_ISA_MODULE_NAME);
|
||||||
err1:
|
err1:
|
||||||
free(gDeviceInfo[0]);
|
free(gDeviceInfo[0]);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ init_hardware(void)
|
|||||||
status_t
|
status_t
|
||||||
init_driver(void)
|
init_driver(void)
|
||||||
{
|
{
|
||||||
status_t ret = B_OK;
|
status_t ret = ENODEV;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TRACE("init_driver\n");
|
TRACE("init_driver\n");
|
||||||
@@ -73,8 +73,16 @@ init_driver(void)
|
|||||||
/* Remember the PCI information */
|
/* Remember the PCI information */
|
||||||
for (i = 0; (*gPciBus->get_nth_pci_info)(i, &gPd->pcii) == B_OK; i++)
|
for (i = 0; (*gPciBus->get_nth_pci_info)(i, &gPd->pcii) == B_OK; i++)
|
||||||
if (gPd->pcii.vendor_id == PCI_VENDOR_ID_VMWARE &&
|
if (gPd->pcii.vendor_id == PCI_VENDOR_ID_VMWARE &&
|
||||||
gPd->pcii.device_id == PCI_DEVICE_ID_VMWARE_SVGA2)
|
gPd->pcii.device_id == PCI_DEVICE_ID_VMWARE_SVGA2) {
|
||||||
|
ret = B_OK;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret != B_OK) {
|
||||||
|
free(gPd);
|
||||||
|
put_module(B_PCI_MODULE_NAME);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a benaphore for exclusive access in OpenHook/FreeHook */
|
/* Create a benaphore for exclusive access in OpenHook/FreeHook */
|
||||||
INIT_BEN(gPd->kernel);
|
INIT_BEN(gPd->kernel);
|
||||||
@@ -116,6 +124,8 @@ void
|
|||||||
uninit_driver()
|
uninit_driver()
|
||||||
{
|
{
|
||||||
TRACE("uninit_driver\n");
|
TRACE("uninit_driver\n");
|
||||||
|
DELETE_BEN(gPd->kernel);
|
||||||
|
free(gPd->names[0]);
|
||||||
free(gPd);
|
free(gPd);
|
||||||
put_module(B_PCI_MODULE_NAME);
|
put_module(B_PCI_MODULE_NAME);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user