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 <a.radenac@lacroix-sofrel.com>
This commit is contained in:
parent
9a07e5ac0d
commit
e8fa6b3f08
|
@ -265,9 +265,11 @@ DMA_STM32_EXPORT_API int dma_stm32_configure(const struct device *dev,
|
||||||
struct dma_stm32_stream *stream =
|
struct dma_stm32_stream *stream =
|
||||||
&dev_config->streams[id - STREAM_OFFSET];
|
&dev_config->streams[id - STREAM_OFFSET];
|
||||||
DMA_TypeDef *dma = (DMA_TypeDef *)dev_config->base;
|
DMA_TypeDef *dma = (DMA_TypeDef *)dev_config->base;
|
||||||
LL_DMA_InitTypeDef DMA_InitStruct = {0};
|
LL_DMA_InitTypeDef DMA_InitStruct;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
LL_DMA_StructInit(&DMA_InitStruct);
|
||||||
|
|
||||||
/* give channel from index 0 */
|
/* give channel from index 0 */
|
||||||
id = id - STREAM_OFFSET;
|
id = id - STREAM_OFFSET;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue