VirtualBox

Ignore:
Timestamp:
Nov 27, 2009 1:40:18 PM (15 years ago)
Author:
vboxsync
Message:

HGSMIHost.cpp: Did a quick cleanup of the saved state error handling before attacking the heap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp

    r24926 r25050  
    9393#define VBOXHGSMI_STATE_FIFOSTOP_MAGIC 0x1fedcba9
    9494
    95 #define VBOXHGSMI_SAVE_START(_pSSM) do{ int rc = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_START_MAGIC); AssertRC(rc);}while(0)
    96 #define VBOXHGSMI_SAVE_STOP(_pSSM) do{ int rc = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_STOP_MAGIC); AssertRC(rc);}while(0)
    97 #define VBOXHGSMI_SAVE_FIFOSTART(_pSSM) do{ int rc = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_FIFOSTART_MAGIC); AssertRC(rc);}while(0)
    98 #define VBOXHGSMI_SAVE_FIFOSTOP(_pSSM) do{ int rc = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_FIFOSTOP_MAGIC); AssertRC(rc);}while(0)
     95#define VBOXHGSMI_SAVE_START(_pSSM)     do{ int rc2 = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_START_MAGIC);      AssertRC(rc2);}while(0)
     96#define VBOXHGSMI_SAVE_STOP(_pSSM)      do{ int rc2 = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_STOP_MAGIC);       AssertRC(rc2);}while(0)
     97#define VBOXHGSMI_SAVE_FIFOSTART(_pSSM) do{ int rc2 = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_FIFOSTART_MAGIC);  AssertRC(rc2);}while(0)
     98#define VBOXHGSMI_SAVE_FIFOSTOP(_pSSM)  do{ int rc2 = SSMR3PutU32(_pSSM, VBOXHGSMI_STATE_FIFOSTOP_MAGIC);   AssertRC(rc2);}while(0)
    9999
    100100#define VBOXHGSMI_LOAD_CHECK(_pSSM, _v) \
    101101    do{ \
    102102        uint32_t u32; \
    103         int rc = SSMR3GetU32(_pSSM, &u32); AssertRC(rc); \
     103        int rc2 = SSMR3GetU32(_pSSM, &u32); AssertRC(rc2); \
    104104        Assert(u32 == (_v)); \
    105105    }while(0)
     
    10861086static int hgsmiHostSaveFifoEntryLocked (HGSMIHOSTFIFOENTRY *pEntry, PSSMHANDLE pSSM)
    10871087{
    1088     int rc = SSMR3PutU32 (pSSM, pEntry->fl); AssertRC(rc);
    1089     rc = SSMR3PutU32 (pSSM, pEntry->offBuffer); AssertRC(rc);
    1090     return rc;
     1088    SSMR3PutU32 (pSSM, pEntry->fl);
     1089    return SSMR3PutU32 (pSSM, pEntry->offBuffer);
    10911090}
    10921091
     
    10991098        ++size;
    11001099    }
    1101     int rc = SSMR3PutU32 (pSSM, size); AssertRC(rc);
    1102 
    1103     for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry; pEntry = pEntry->pNext)
     1100    int rc = SSMR3PutU32 (pSSM, size);
     1101
     1102    for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry && RT_SUCCESS(rc); pEntry = pEntry->pNext)
    11041103    {
    11051104        HGSMIHOSTFIFOENTRY *pFifoEntry = HGSMILISTENTRY_2_FIFOENTRY(pEntry);
    1106         rc = hgsmiHostSaveFifoEntryLocked (pFifoEntry, pSSM);  AssertRC(rc);
     1105        rc = hgsmiHostSaveFifoEntryLocked (pFifoEntry, pSSM);
    11071106    }
    11081107
     
    11231122        pEntry->fl = u32;
    11241123        rc = SSMR3GetU32 (pSSM, &pEntry->offBuffer); AssertRC(rc);
    1125         *ppEntry = pEntry;
     1124        if (RT_SUCCESS (rc))
     1125            *ppEntry = pEntry;
     1126        else
     1127            hgsmiHostFIFOFree (pIns, pEntry);
    11261128    }
    11271129
     
    11401142        {
    11411143            HGSMIHOSTFIFOENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
    1142             rc = hgsmiHostLoadFifoEntryLocked (pIns, &pFifoEntry, pSSM); AssertRC(rc);
    1143             if (RT_SUCCESS (rc))
    1144             {
    1145                 hgsmiListAppend (pFifo, &pFifoEntry->entry);
    1146             }
     1144            rc = hgsmiHostLoadFifoEntryLocked (pIns, &pFifoEntry, pSSM);
     1145            AssertRCBreak(rc);
     1146            hgsmiListAppend (pFifo, &pFifoEntry->entry);
    11471147        }
    11481148    }
     
    11611161
    11621162    HGSMIOFFSET off = pIns->pHGFlags ? HGSMIPointerToOffset(&pIns->area, (const HGSMIBUFFERHEADER *)pIns->pHGFlags) : HGSMIOFFSET_VOID;
    1163     rc = SSMR3PutU32 (pSSM, off); AssertRC(rc);
     1163    SSMR3PutU32 (pSSM, off);
    11641164
    11651165    off = HGSMIHeapHandleLocationOffset(&pIns->hostHeap);
    1166     rc = SSMR3PutU32 (pSSM, off); AssertRC(rc);
     1166    rc = SSMR3PutU32 (pSSM, off);
    11671167    if(off != HGSMIOFFSET_VOID)
    11681168    {
    1169         rc = SSMR3PutU32 (pSSM, HGSMIHeapOffset(&pIns->hostHeap)); AssertRC(rc);
    1170         rc = SSMR3PutU32(pSSM, HGSMIHeapSize(&pIns->hostHeap)); AssertRC(rc);
     1169        SSMR3PutU32 (pSSM, HGSMIHeapOffset(&pIns->hostHeap));
     1170        SSMR3PutU32 (pSSM, HGSMIHeapSize(&pIns->hostHeap));
    11711171        /* need save mem pointer to calculate offset on restore */
    1172         rc = SSMR3PutU64 (pSSM, (uint64_t)pIns->area.pu8Base); AssertRC(rc);
    1173         rc = hgsmiFIFOLock (pIns); AssertRC(rc);
     1172        SSMR3PutU64 (pSSM, (uint64_t)pIns->area.pu8Base);
     1173        rc = hgsmiFIFOLock (pIns);
    11741174        if(RT_SUCCESS(rc))
    11751175        {
     
    11961196    int rc;
    11971197    HGSMIOFFSET off;
    1198     rc = SSMR3GetU32(pSSM, &off); AssertRC(rc);
     1198    rc = SSMR3GetU32(pSSM, &off);
     1199    AssertRCReturn(rc, rc);
    11991200    pIns->pHGFlags = (off != HGSMIOFFSET_VOID) ? (HGSMIHOSTFLAGS*)HGSMIOffsetToPointer (&pIns->area, off) : NULL;
    12001201
    12011202    HGSMIHEAP hHeap = pIns->hostHeap;
    1202     rc = SSMR3GetU32(pSSM, &off); AssertRC(rc);
     1203    rc = SSMR3GetU32(pSSM, &off);
     1204    AssertRCReturn(rc, rc);
    12031205    if(off != HGSMIOFFSET_VOID)
    12041206    {
    12051207        HGSMIOFFSET offHeap;
     1208        SSMR3GetU32(pSSM, &offHeap);
    12061209        uint32_t cbHeap;
    1207         rc = SSMR3GetU32(pSSM, &offHeap); AssertRC(rc);
    1208         rc = SSMR3GetU32(pSSM, &cbHeap); AssertRC(rc);
     1210        SSMR3GetU32(pSSM, &cbHeap);
    12091211        uint64_t oldMem;
    1210         rc = SSMR3GetU64(pSSM, &oldMem); AssertRC(rc);
    1211 
    1212         rc = hgsmiHostHeapLock (pIns); AssertRC(rc);
     1212        rc = SSMR3GetU64(pSSM, &oldMem);
     1213        AssertRCReturn(rc, rc);
     1214
     1215        rc = hgsmiHostHeapLock (pIns);
    12131216        if (RT_SUCCESS (rc))
    12141217        {
     
    12251228        }
    12261229
    1227 
    1228         rc = hgsmiFIFOLock (pIns); AssertRC(rc);
    1229         if(RT_SUCCESS(rc))
    1230         {
    1231             rc = hgsmiHostLoadFifoLocked (pIns, &pIns->hostFIFO, pSSM); AssertRC(rc);
    1232             rc = hgsmiHostLoadFifoLocked (pIns, &pIns->hostFIFORead, pSSM); AssertRC(rc);
    1233             rc = hgsmiHostLoadFifoLocked (pIns, &pIns->hostFIFOProcessed, pSSM); AssertRC(rc);
    1234 
    1235             hgsmiFIFOUnlock (pIns);
     1230        if (RT_SUCCESS(rc))
     1231        {
     1232            rc = hgsmiFIFOLock (pIns);
     1233            if(RT_SUCCESS(rc))
     1234            {
     1235                rc = hgsmiHostLoadFifoLocked (pIns, &pIns->hostFIFO, pSSM);
     1236                if (RT_SUCCESS(rc))
     1237                    rc = hgsmiHostLoadFifoLocked (pIns, &pIns->hostFIFORead, pSSM);
     1238                if (RT_SUCCESS(rc))
     1239                    rc = hgsmiHostLoadFifoLocked (pIns, &pIns->hostFIFOProcessed, pSSM);
     1240
     1241                hgsmiFIFOUnlock (pIns);
     1242            }
    12361243        }
    12371244    }
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