VirtualBox

Changeset 34452 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Nov 29, 2010 11:20:09 AM (14 years ago)
Author:
vboxsync
Message:

SCSI: Fix crash on startup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DrvSCSI.cpp

    r34433 r34452  
    735735static DECLCALLBACK(int) drvscsiConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
    736736{
     737    int rc = VINF_SUCCESS;
    737738    PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
    738739    LogFlowFunc(("pDrvIns=%#p pCfg=%#p\n", pDrvIns, pCfg));
     
    750751    pThis->IPortAsync.pfnTransferCompleteNotify = drvscsiTransferCompleteNotify;
    751752
     753    /* Query the SCSI port interface above. */
     754    pThis->pDevScsiPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMISCSIPORT);
     755    AssertMsgReturn(pThis->pDevScsiPort, ("Missing SCSI port interface above\n"), VERR_PDM_MISSING_INTERFACE);
     756
     757    /* Query the optional LED interface above. */
     758    pThis->pLedPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
     759    if (pThis->pLedPort != NULL)
     760    {
     761        /* Get The Led. */
     762        rc = pThis->pLedPort->pfnQueryStatusLed(pThis->pLedPort, 0, &pThis->pLed);
     763        if (RT_FAILURE(rc))
     764            pThis->pLed = &pThis->Led;
     765    }
     766    else
     767        pThis->pLed = &pThis->Led;
     768
    752769    /*
    753770     * Try attach driver below and query it's block interface.
    754771     */
    755     int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pThis->pDrvBase);
     772    rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pThis->pDrvBase);
    756773    AssertMsgReturn(RT_SUCCESS(rc), ("Attaching driver below failed rc=%Rrc\n", rc), rc);
    757774
     
    772789    }
    773790
    774     /* Query the SCSI port interface above. */
    775     pThis->pDevScsiPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMISCSIPORT);
    776     AssertMsgReturn(pThis->pDevScsiPort, ("Missing SCSI port interface above\n"), VERR_PDM_MISSING_INTERFACE);
    777 
    778791    pThis->pDrvMount = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIMOUNT);
    779 
    780     /* Query the optional LED interface above. */
    781     pThis->pLedPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
    782     if (pThis->pLedPort != NULL)
    783     {
    784         /* Get The Led. */
    785         rc = pThis->pLedPort->pfnQueryStatusLed(pThis->pLedPort, 0, &pThis->pLed);
    786         if (RT_FAILURE(rc))
    787             pThis->pLed = &pThis->Led;
    788     }
    789     else
    790         pThis->pLed = &pThis->Led;
    791792
    792793    /* Try to get the optional async block interface. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette