This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit d470c3f26849936ad65fe65ebe6db5af51e63fa9
Author: Michal Lenc <[email protected]>
AuthorDate: Mon Jul 3 12:43:06 2023 +0200

    samv7/sam_serial.c: reset all DMA pointers on DMA setup
    
    This small fix ensures all DMA pointers are correctly reseted during
    DMA setup (when the driver is opened). Without this there could be rare
    occurrence of driver pointer to incorrect (invalidate) DMA buffer and thus
    saving incorrect characters to upper layer.
    
    Signed-off-by: Michal Lenc <[email protected]>
---
 arch/arm/src/samv7/sam_serial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/src/samv7/sam_serial.c b/arch/arm/src/samv7/sam_serial.c
index 6a4318aaca..744dbc5235 100644
--- a/arch/arm/src/samv7/sam_serial.c
+++ b/arch/arm/src/samv7/sam_serial.c
@@ -1228,6 +1228,8 @@ static int sam_dma_setup(struct uart_dev_s *dev)
        */
 
       priv->rxdmanext = 0;
+      priv->nextcache = 0;
+      priv->buf_idx = 0;
       priv->rxenable = true;
       priv->odd = false;
 

Reply via email to