summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author7YZ7 <[email protected]>2023-05-15 14:42:11 +0800
committerGitHub <[email protected]>2023-05-15 14:42:11 +0800
commita5211c70b6d115623f0cf4ff428f6b04daa24223 (patch)
tree59260bf71ce47d7629ba044818f0bf53471cf1b3
parent7a2bccd1c28eb770971ab8f7e5a1bfb529156f39 (diff)
[components][drivers][HUST CSE]修复serial_v2.c中可能产生的死循环 (#7394)
-rw-r--r--components/drivers/serial/serial_v2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/drivers/serial/serial_v2.c b/components/drivers/serial/serial_v2.c
index e7a9ffe14c..2a93656ae3 100644
--- a/components/drivers/serial/serial_v2.c
+++ b/components/drivers/serial/serial_v2.c
@@ -691,11 +691,11 @@ static rt_err_t rt_serial_tx_enable(struct rt_device *dev,
serial->ops->control(serial,
RT_DEVICE_CTRL_CONFIG,
(void *)RT_SERIAL_TX_BLOCKING);
+ rt_memset(&tx_fifo->rb, RT_NULL, sizeof(tx_fifo->rb));
}
tx_fifo->activated = RT_FALSE;
tx_fifo->put_size = 0;
- rt_memset(&tx_fifo->rb, RT_NULL, sizeof(tx_fifo->rb));
rt_completion_init(&(tx_fifo->tx_cpt));
dev->open_flag |= RT_SERIAL_TX_BLOCKING;