VirtualBox

Changeset 67806 in vbox


Ignore:
Timestamp:
Jul 5, 2017 3:48:20 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116730
Message:

Devices: when attaching a driver, don't pass a local variable as description

Location:
trunk/src/VBox/Devices
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/VBox/Devices/Audio/DevHDA.cpp

    r67710 r67806  
    68956895     * Attach driver.
    68966896     */
    6897     char *pszDesc = NULL;
     6897    char *pszDesc;
    68986898    if (RTStrAPrintf(&pszDesc, "Audio driver port (HDA) for LUN#%u", uLUN) <= 0)
    6899         AssertReleaseMsgReturn(pszDesc,
    6900                                ("Not enough memory for HDA driver port description of LUN #%u\n", uLUN),
    6901                                VERR_NO_MEMORY);
     6899        AssertLogRelFailedReturn(VERR_NO_MEMORY);
    69026900
    69036901    PPDMIBASE pDrvBase;
  • TabularUnified trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r67780 r67806  
    32213221     * Attach driver.
    32223222     */
    3223     char *pszDesc = NULL;
     3223    char *pszDesc;
    32243224    if (RTStrAPrintf(&pszDesc, "Audio driver port (AC'97) for LUN #%u", uLUN) <= 0)
    3225         AssertReleaseMsgReturn(pszDesc,
    3226                                ("Not enough memory for AC'97 driver port description of LUN #%u\n", uLUN),
    3227                                VERR_NO_MEMORY);
     3225        AssertLogRelFailedReturn(VERR_NO_MEMORY);
    32283226
    32293227    PPDMIBASE pDrvBase;
  • TabularUnified trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r67717 r67806  
    219219     * Attach driver.
    220220     */
    221     char *pszDesc = NULL;
     221    char *pszDesc;
    222222    if (RTStrAPrintf(&pszDesc, "Audio driver port (SB16) for LUN #%u", uLUN) <= 0)
    223         AssertReleaseMsgReturn(pszDesc,
    224                                ("Not enough memory for SB16 driver port description of LUN #%u\n", uLUN),
    225                                VERR_NO_MEMORY);
     223        AssertLogRelFailedReturn(VERR_NO_MEMORY);
    226224
    227225    PPDMIBASE pDrvBase;
  • TabularUnified trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r67681 r67806  
    60206020    for (i = 0; i < pThis->cPortsImpl; i++)
    60216021    {
    6022         char szName[24];
    6023         RTStrPrintf(szName, sizeof(szName), "Port%u", i);
     6022        char *pszName;
     6023        if (RTStrAPrintf(&pszName, "Port%u", i) <= 0)
     6024            AssertLogRelFailedReturn(VERR_NO_MEMORY);
    60246025
    60256026        PAHCIPort pAhciPort      = &pThis->ahciPort[i];
     
    60396040
    60406041        /* Query per port configuration options if available. */
    6041         PCFGMNODE pCfgPort = CFGMR3GetChild(pDevIns->pCfg, szName);
     6042        PCFGMNODE pCfgPort = CFGMR3GetChild(pDevIns->pCfg, pszName);
    60426043        if (pCfgPort)
    60436044        {
     
    60516052         * Attach the block driver
    60526053         */
    6053         rc = PDMDevHlpDriverAttach(pDevIns, pAhciPort->iLUN, &pAhciPort->IBase, &pAhciPort->pDrvBase, szName);
     6054        rc = PDMDevHlpDriverAttach(pDevIns, pAhciPort->iLUN, &pAhciPort->IBase, &pAhciPort->pDrvBase, pszName);
    60546055        if (RT_SUCCESS(rc))
    60556056        {
     
    60576058            if (RT_FAILURE(rc))
    60586059            {
    6059                 Log(("%s: Failed to configure the %s.\n", __FUNCTION__, szName));
     6060                Log(("%s: Failed to configure the %s.\n", __FUNCTION__, pszName));
    60606061                return rc;
    60616062            }
     
    60686069             * Init vendor product data.
    60696070             */
    6070             rc = ahciR3VpdInit(pDevIns, pAhciPort, szName);
     6071            rc = ahciR3VpdInit(pDevIns, pAhciPort, pszName);
    60716072            if (RT_FAILURE(rc))
    60726073                return rc;
     
    60786079
    60796080            rc = PDMDevHlpThreadCreate(pDevIns, &pAhciPort->pAsyncIOThread, pAhciPort, ahciAsyncIOLoop,
    6080                                        ahciAsyncIOLoopWakeUp, 0, RTTHREADTYPE_IO, szName);
     6081                                       ahciAsyncIOLoopWakeUp, 0, RTTHREADTYPE_IO, pszName);
    60816082            if (RT_FAILURE(rc))
    60826083                return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    6083                                            N_("AHCI: Failed to create worker thread %s"), szName);
     6084                                           N_("AHCI: Failed to create worker thread %s"), pszName);
    60846085        }
    60856086        else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
     
    60876088            pAhciPort->pDrvBase = NULL;
    60886089            rc = VINF_SUCCESS;
    6089             LogRel(("AHCI: %s: No driver attached\n", szName));
     6090            LogRel(("AHCI: %s: No driver attached\n", pszName));
    60906091        }
    60916092        else
    60926093            return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    6093                                        N_("AHCI: Failed to attach drive to %s"), szName);
     6094                                       N_("AHCI: Failed to attach drive to %s"), pszName);
    60946095    }
    60956096
  • TabularUnified trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r67682 r67806  
    41544154        PBUSLOGICDEVICE pDevice = &pThis->aDeviceStates[i];
    41554155
    4156         RTStrPrintf(szName, sizeof(szName), "Device%u", i);
     4156        char *pszName;
     4157        if (RTStrAPrintf(&pszName, "Device%u", i) < 0)
     4158            AssertLogRelFailedReturn(VERR_NO_MEMORY);
    41574159
    41584160        /* Initialize static parts of the device. */
     
    41744176
    41754177        /* Attach SCSI driver. */
    4176         rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, szName);
     4178        rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, pszName);
    41774179        if (RT_SUCCESS(rc))
    41784180        {
  • TabularUnified trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp

    r65648 r67806  
    55955595    for (unsigned i = 0; i < pThis->cDeviceStates; i++)
    55965596    {
    5597         char szName[24];
    55985597        PLSILOGICDEVICE pDevice = &pThis->paDeviceStates[i];
    55995598
     
    56135612        pDevice->ILed.pfnQueryStatusLed                  = lsilogicR3DeviceQueryStatusLed;
    56145613
    5615         RTStrPrintf(szName, sizeof(szName), "Device%u", i);
     5614        char *pszName;
     5615        if (RTStrAPrintf(&pszName, "Device%u", i) <= 0)
     5616            AssertLogRelFailedReturn(VERR_NO_MEMORY);
    56165617
    56175618        /* Attach SCSI driver. */
    5618         rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, szName);
     5619        rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, pszName);
    56195620        if (RT_SUCCESS(rc))
    56205621        {
     
    56415642            pDevice->pDrvBase = NULL;
    56425643            rc = VINF_SUCCESS;
    5643             Log(("LsiLogic: no driver attached to device %s\n", szName));
     5644            Log(("LsiLogic: no driver attached to device %s\n", pszName));
    56445645        }
    56455646        else
    56465647        {
    5647             AssertLogRelMsgFailed(("LsiLogic: Failed to attach %s\n", szName));
     5648            AssertLogRelMsgFailed(("LsiLogic: Failed to attach %s\n", pszName));
    56485649            return rc;
    56495650        }
Note: See TracChangeset for help on using the changeset viewer.

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