VirtualBox

Changeset 90447 in vbox for trunk/src/VBox/Devices/Serial


Ignore:
Timestamp:
Jul 31, 2021 12:44:13 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146051
Message:

Dev*: Checked up all the PDMDevHlpCritSectEnter calls to make sure the status code is checked. bugref:6695

File:
1 edited

Legend:

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

    r90445 r90447  
    15981598    AssertMsg((uint32_t)cbAvail == cbAvail, ("Too much data available\n"));
    15991599
    1600     PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1600    int rcLock = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1601    AssertRCReturn(rcLock, rcLock);
     1602
    16011603    uint32_t cbAvailOld = ASMAtomicAddU32(&pThis->cbAvailRdr, (uint32_t)cbAvail);
    16021604    LogFlow(("    cbAvailRdr=%u -> cbAvailRdr=%u\n", cbAvailOld, cbAvail + cbAvailOld));
     
    16151617        }
    16161618    }
     1619
    16171620    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    1618 
    16191621    return VINF_SUCCESS;
    16201622}
     
    16321634
    16331635    /* Set the transmitter empty bit because everything was sent. */
    1634     PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1636    int const rcLock = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1637    AssertRCReturn(rcLock, rcLock);
     1638
    16351639    UART_REG_SET(pThis->uRegLsr, UART_REG_LSR_TEMT);
    16361640    uartIrqUpdate(pDevIns, pThis, pThisCC);
     1641
    16371642    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    16381643    return VINF_SUCCESS;
     
    16521657    AssertReturn(cbRead > 0, VERR_INVALID_PARAMETER);
    16531658
    1654     PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1659    int const rcLock = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1660    AssertRCReturn(rcLock, rcLock);
     1661
    16551662    uartR3TxQueueCopyFrom(pDevIns, pThis, pThisCC, pvBuf, cbRead, pcbRead);
     1663
    16561664    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    1657 
    16581665    LogFlowFunc(("-> VINF_SUCCESS{*pcbRead=%zu}\n", *pcbRead));
    16591666    return VINF_SUCCESS;
     
    16701677    PUARTCORE   pThis   = pThisCC->pShared;
    16711678    PPDMDEVINS  pDevIns = pThisCC->pDevIns;
    1672 
    1673     PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1679    int const   rcLock  = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1680    AssertRCReturn(rcLock, rcLock);
     1681
    16741682    uartR3StsLinesUpdate(pDevIns, pThis, pThisCC, fNewStatusLines);
     1683
    16751684    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    16761685    return VINF_SUCCESS;
     
    16871696    PUARTCORE   pThis   = pThisCC->pShared;
    16881697    PPDMDEVINS  pDevIns = pThisCC->pDevIns;
    1689 
    1690     PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1698    int const   rcLock  = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1699    AssertRCReturn(rcLock, rcLock);
     1700
    16911701    UART_REG_SET(pThis->uRegLsr, UART_REG_LSR_BI);
    16921702    uartIrqUpdate(pDevIns, pThis, pThisCC);
     1703
    16931704    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    16941705    return VINF_SUCCESS;
     
    19491960            return VERR_PDM_MISSING_INTERFACE;
    19501961        }
    1951         PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
    1952         uartR3XferReset(pDevIns, pThis, pThisCC);
    1953         PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     1962        rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1963        if (RT_SUCCESS(rc))
     1964        {
     1965            uartR3XferReset(pDevIns, pThis, pThisCC);
     1966            PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     1967        }
    19541968    }
    19551969    else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
     
    19571971        pThisCC->pDrvBase = NULL;
    19581972        pThisCC->pDrvSerial = NULL;
    1959         rc = VINF_SUCCESS;
    1960         PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
    1961         uartR3XferReset(pDevIns, pThis, pThisCC);
    1962         PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     1973        rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     1974        if (RT_SUCCESS(rc))
     1975        {
     1976            uartR3XferReset(pDevIns, pThis, pThisCC);
     1977            PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
     1978        }
    19631979        LogRel(("Serial#%d: no unit\n", pDevIns->iInstance));
    19641980    }
     
    19831999    pThisCC->pDrvBase   = NULL;
    19842000    pThisCC->pDrvSerial = NULL;
    1985     PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     2001    int const rcLock = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
     2002    PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(pDevIns, &pThis->CritSect, rcLock);
     2003
    19862004    uartR3XferReset(pDevIns, pThis, pThisCC);
     2005
    19872006    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    19882007}
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