VirtualBox

Changeset 1738 in vbox


Ignore:
Timestamp:
Mar 27, 2007 4:16:11 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
19899
Message:

Clean up properly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DevSerial.cpp

    r1736 r1738  
    418418    int          rc = VINF_SUCCESS;
    419419
    420     if (cb == 1)
     420    if (cb == 1) 
    421421    {
    422422        rc = PDMCritSectEnter(&pData->CritSect, VINF_IOM_HC_IOPORT_WRITE);
     
    428428        }
    429429    }
    430     else
     430    else 
    431431        AssertMsgFailed(("Port=%#x cb=%d u32=%#x\n", Port, cb, u32));
    432432
     
    451451    int          rc = VINF_SUCCESS;
    452452
    453     if (cb == 1)
     453    if (cb == 1) 
    454454    {
    455455        rc = PDMCritSectEnter(&pData->CritSect, VINF_IOM_HC_IOPORT_READ);
     
    462462        }
    463463    }
    464     else
     464    else 
    465465        rc = VERR_IOM_IOPORT_UNUSED;
    466466
     
    512512    SerialState *pData = PDMINS2DATA(pDevIns, SerialState *);
    513513
    514     if (u32Version != SERIAL_SAVED_STATE_VERSION)
     514    if (u32Version != SERIAL_SAVED_STATE_VERSION) 
    515515    {
    516516        AssertMsgFailed(("u32Version=%d\n", u32Version));
     
    535535        return rc;
    536536
    537     if (u32 != ~0U)
     537    if (u32 != ~0U) 
    538538    {
    539539        AssertMsgFailed(("u32=%#x expected ~0\n", u32));
     
    603603            return NULL;
    604604    }
     605}
     606
     607/**
     608 * Destruct a device instance.
     609 *
     610 * Most VM resources are freed by the VM. This callback is provided so that any non-VM
     611 * resources can be freed correctly.
     612 *
     613 * @returns VBox status.
     614 * @param   pDevIns     The device instance data.
     615 */
     616static DECLCALLBACK(int) serialDestruct(PPDMDEVINS pDevIns)
     617{
     618    SerialState *pData = PDMINS2DATA(pDevIns, SerialState *);
     619
     620    RTSemEventDestroy(pData->ReceiveSem);
     621    pData->ReceiveSem = NIL_RTSEMEVENT;
     622
     623    PDMR3CritSectDelete(&pData->CritSect);
     624    return VINF_SUCCESS;
    605625}
    606626
     
    636656     * Validate configuration.
    637657     */
    638     if (!CFGMR3AreValuesValid(pCfgHandle, "IRQ\0IOBase\0"))
     658    if (!CFGMR3AreValuesValid(pCfgHandle, "IRQ\0IOBase\0")) 
    639659        return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
    640660
     
    676696 * and CFGR3AreValuesValid() like we're doing in the other devices.  */
    677697    rc = CFGMR3QueryU8 (pCfgHandle, "IRQ", &irq_lvl);
    678     if (VBOX_FAILURE (rc))
     698    if (VBOX_FAILURE (rc)) 
    679699        return rc;
    680700
    681701    rc = CFGMR3QueryU16 (pCfgHandle, "IOBase", &io_base);
    682     if (VBOX_FAILURE (rc))
     702    if (VBOX_FAILURE (rc)) 
    683703        return rc;
    684704
     
    800820    serialConstruct,
    801821    /* pfnDestruct */
    802     NULL,
     822    serialDestruct,
    803823    /* pfnRelocate */
    804824    serialRelocate,
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