From e8fa6b3f0835b4fd7ab7ab6f51889a5cd0b9169b Mon Sep 17 00:00:00 2001 From: Abel Radenac Date: Mon, 29 Mar 2021 18:14:29 +0200 Subject: [PATCH] drivers: dma_stm32: init DMA struct in dma_stm32_configure The init struct for DMA peripheral is allocated in stack and must be initialized (e.g. with LL_DMA_StructInit here) to avoid loading undefined values in the DMA peripheral registers. Signed-off-by: Abel Radenac --- drivers/dma/dma_stm32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dma_stm32.c b/drivers/dma/dma_stm32.c index b1ad48f2eb..d90278b248 100644 --- a/drivers/dma/dma_stm32.c +++ b/drivers/dma/dma_stm32.c @@ -265,9 +265,11 @@ DMA_STM32_EXPORT_API int dma_stm32_configure(const struct device *dev, struct dma_stm32_stream *stream = &dev_config->streams[id - STREAM_OFFSET]; DMA_TypeDef *dma = (DMA_TypeDef *)dev_config->base; - LL_DMA_InitTypeDef DMA_InitStruct = {0}; + LL_DMA_InitTypeDef DMA_InitStruct; int ret; + LL_DMA_StructInit(&DMA_InitStruct); + /* give channel from index 0 */ id = id - STREAM_OFFSET;