Skip to content

Commit a5211c7

Browse files
authoredMay 15, 2023
[components][drivers][HUST CSE]修复serial_v2.c中可能产生的死循环 (#7394)
1 parent 7a2bccd commit a5211c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎components/drivers/serial/serial_v2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -691,11 +691,11 @@ static rt_err_t rt_serial_tx_enable(struct rt_device *dev,
691691
serial->ops->control(serial,
692692
RT_DEVICE_CTRL_CONFIG,
693693
(void *)RT_SERIAL_TX_BLOCKING);
694+
rt_memset(&tx_fifo->rb, RT_NULL, sizeof(tx_fifo->rb));
694695
}
695696

696697
tx_fifo->activated = RT_FALSE;
697698
tx_fifo->put_size = 0;
698-
rt_memset(&tx_fifo->rb, RT_NULL, sizeof(tx_fifo->rb));
699699
rt_completion_init(&(tx_fifo->tx_cpt));
700700
dev->open_flag |= RT_SERIAL_TX_BLOCKING;
701701

0 commit comments

Comments
 (0)
Please sign in to comment.