X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdrv%2Fpci.c;h=20eb93261ec6cee8bc44f1028559ad4418c9fccd;hb=e29b02ca55d580b2f7f10d1093c3d6ad1bc59458;hp=dfbc8ca27aa4b79f539973915cdd200159af1839;hpb=1e25b20fd5d119d3b5673d6a31f60b2da676de98;p=tpg%2Facess2.git diff --git a/Kernel/drv/pci.c b/Kernel/drv/pci.c index dfbc8ca2..20eb9326 100644 --- a/Kernel/drv/pci.c +++ b/Kernel/drv/pci.c @@ -88,6 +88,10 @@ int PCI_Install(char **Arguments) // Build Portmap gaPCI_PortBitmap = malloc( 1 << 13 ); + if( !gaPCI_PortBitmap ) { + Log_Error("PCI", "Unable to allocate %i bytes for bitmap", 1 << 13); + return MODULE_ERR_MALLOC; + } memset( gaPCI_PortBitmap, 0, 1 << 13 ); for( i = 0; i < MAX_RESERVED_PORT / 32; i ++ ) gaPCI_PortBitmap[i] = -1; @@ -110,13 +114,13 @@ int PCI_Install(char **Arguments) space += SPACE_STEP; tmpPtr = realloc(gPCI_Devices, space*sizeof(tPCIDevice)); if(tmpPtr == NULL) - break; + return MODULE_ERR_MALLOC; gPCI_Devices = tmpPtr; } if(devInfo.oc == PCI_OC_PCIBRIDGE) { #if LIST_DEVICES - Log("[PCI ] Bridge @ %i,%i:%i (0x%x:0x%x)", + Log_Log("PCI", "Bridge @ %i,%i:%i (0x%x:0x%x)", bus, dev, fcn, devInfo.vendor, devInfo.device); #endif giPCI_BusCount++; @@ -124,7 +128,7 @@ int PCI_Install(char **Arguments) else { #if LIST_DEVICES - Log("[PCI ] Device %i,%i:%i %04x => 0x%04x:0x%04x", + Log_Log("PCI", "Device %i,%i:%i %04x => 0x%04x:0x%04x", bus, dev, fcn, devInfo.oc, devInfo.vendor, devInfo.device); #endif } @@ -141,22 +145,20 @@ int PCI_Install(char **Arguments) break; } } - if(tmpPtr != gPCI_Devices) - break; } - if(tmpPtr != gPCI_Devices) - break; } - if(giPCI_DeviceCount == 0) + if(giPCI_DeviceCount == 0) { + Log_Notice("PCI", "No devices were found"); return MODULE_ERR_NOTNEEDED; + } tmpPtr = realloc(gPCI_Devices, giPCI_DeviceCount*sizeof(tPCIDevice)); if(tmpPtr == NULL) return MODULE_ERR_MALLOC; gPCI_Devices = tmpPtr; - // Complete Driver Structure + // Complete Driver Structure gPCI_DriverStruct.RootNode.Size = giPCI_DeviceCount; // And add to DevFS