Skip to content

Commit

Permalink
fixed tx_fifo->rb.buffer_ptr not init in serial_v2.c, when not use RT…
Browse files Browse the repository at this point in the history
…_SERIAL_TX_BLOCKING_BUFFER (RT_DEVICE_FLAG_DMA_TX and RT_DEVICE_FLAG_TX_BLOCKING)
  • Loading branch information
ComerLater committed Dec 22, 2023
1 parent e31fa93 commit 6c6d4d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/drivers/serial/serial_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ static rt_err_t rt_serial_tx_enable(struct rt_device *dev,
(sizeof(struct rt_serial_tx_fifo));
RT_ASSERT(tx_fifo != RT_NULL);

/* Init rb.buffer_ptr to RT_NULL, in rt_serial_write() need check it
* otherwise buffer_ptr maybe a random value, as rt_malloc not init memory */
tx_fifo->rb.buffer_ptr = RT_NULL;
serial->serial_tx = tx_fifo;

#ifndef RT_USING_DEVICE_OPS
Expand Down

0 comments on commit 6c6d4d1

Please sign in to comment.