mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
bluetooth: add nxmutex_lock check
Signed-off-by: chengkai <chengkai@xiaomi.com>
This commit is contained in:
@@ -698,7 +698,12 @@ static int bt_slip_send(FAR struct bt_driver_s *dev,
|
|||||||
|
|
||||||
priv = (FAR struct sliphci_s *)dev;
|
priv = (FAR struct sliphci_s *)dev;
|
||||||
|
|
||||||
nxmutex_lock(&priv->sliplock);
|
ret = nxmutex_lock(&priv->sliplock);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (bt_slip_unack_size(priv) >= priv->txwin)
|
if (bt_slip_unack_size(priv) >= priv->txwin)
|
||||||
{
|
{
|
||||||
bt_slip_send_ack(priv);
|
bt_slip_send_ack(priv);
|
||||||
@@ -711,7 +716,11 @@ static int bt_slip_send(FAR struct bt_driver_s *dev,
|
|||||||
{
|
{
|
||||||
nxmutex_unlock(&priv->sliplock);
|
nxmutex_unlock(&priv->sliplock);
|
||||||
nxsem_wait_uninterruptible(&priv->sem);
|
nxsem_wait_uninterruptible(&priv->sem);
|
||||||
nxmutex_lock(&priv->sliplock);
|
ret = nxmutex_lock(&priv->sliplock);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -767,6 +776,7 @@ static int bt_slip_receive(FAR struct bt_driver_s *drv,
|
|||||||
uint16_t checksum;
|
uint16_t checksum;
|
||||||
size_t remaining;
|
size_t remaining;
|
||||||
uint8_t state;
|
uint8_t state;
|
||||||
|
int ret;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PACKET_START,
|
PACKET_START,
|
||||||
@@ -776,7 +786,12 @@ static int bt_slip_receive(FAR struct bt_driver_s *drv,
|
|||||||
PACKET_END,
|
PACKET_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
nxmutex_lock(&priv->sliplock);
|
ret = nxmutex_lock(&priv->sliplock);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
for (packet = data, cursor = data, header = data, state = PACKET_START;
|
for (packet = data, cursor = data, header = data, state = PACKET_START;
|
||||||
packet < (FAR uint8_t *)data + len; packet++)
|
packet < (FAR uint8_t *)data + len; packet++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user