From a5211c70b6d115623f0cf4ff428f6b04daa24223 Mon Sep 17 00:00:00 2001 From: 7YZ7 Date: Mon, 15 May 2023 14:42:11 +0800 Subject: [components][drivers][HUST CSE]修复serial_v2.c中可能产生的死循环 (#7394) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/serial/serial_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.3.1