- Timestamp:
- Nov 2, 2009 4:44:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMDevice.cpp
r23077 r24272 209 209 210 210 /* Enumerate the device instances. */ 211 uint32_t const iStart = i; 211 212 for (pInstanceNode = CFGMR3GetFirstChild(pCur); pInstanceNode; pInstanceNode = CFGMR3GetNextChild(pInstanceNode)) 212 213 { … … 227 228 i++; 228 229 } 230 231 /* check the number of instances */ 232 if (i - iStart > pDev->pDevReg->cMaxInstances) 233 AssertLogRelMsgFailedReturn(("Configuration error: Too many instances of %s was configured: %u, max %u\n", 234 szName, i - iStart, pDev->pDevReg->cMaxInstances), 235 VERR_PDM_TOO_MANY_DEVICE_INSTANCES); 229 236 } /* devices */ 230 237 Assert(i == cDevs); … … 285 292 * Allocate the device instance. 286 293 */ 294 AssertReturn(paDevs[i].pDev->cInstances < paDevs[i].pDev->pDevReg->cMaxInstances, VERR_PDM_TOO_MANY_DEVICE_INSTANCES); 287 295 size_t cb = RT_OFFSETOF(PDMDEVINS, achInstanceData[paDevs[i].pDev->pDevReg->cbInstance]); 288 296 cb = RT_ALIGN_Z(cb, 16); … … 357 365 * Call the constructor. 358 366 */ 367 paDevs[i].pDev->cInstances++; 359 368 Log(("PDM: Constructing device '%s' instance %d...\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance)); 360 369 rc = pDevIns->pDevReg->pfnConstruct(pDevIns, pDevIns->iInstance, pDevIns->pCfgHandle); … … 362 371 { 363 372 LogRel(("PDM: Failed to construct '%s'/%d! %Rra\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc)); 373 paDevs[i].pDev->cInstances--; 364 374 /* because we're damn lazy right now, we'll say that the destructor will be called even if the constructor fails. */ 365 375 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.