Skip to content
/ linux Public

Commit c219c20

Browse files
UpsylonbareSasha Levin
authored andcommitted
dmaengine: stm32-mdma: initialize m2m_hw_period and ccr to fix warnings
[ Upstream commit aaf3bc0 ] m2m_hw_period is initialized only when chan_config->m2m_hw is true. This triggers a warning: ‘m2m_hw_period’ may be used uninitialized [-Wmaybe-uninitialized] Although m2m_hw_period is only used when chan_config->m2m_hw is true and ignored otherwise, initialize it unconditionally to 0. ccr is initialized by stm32_mdma_set_xfer_param() when the sg list is not empty. This triggers a warning: ‘ccr’ may be used uninitialized [-Wmaybe-uninitialized] Indeed, it could be used uninitialized if the sg list is empty. Initialize it to 0. Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com> Reviewed-by: Clément Le Goffic <legoffic.clement@gmail.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com> Link: https://patch.msgid.link/20251217-mdma_warnings_fix-v2-1-340200e0bb55@foss.st.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f89324e commit c219c20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/dma/stm32-mdma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ static int stm32_mdma_setup_xfer(struct stm32_mdma_chan *chan,
732732
struct stm32_mdma_chan_config *chan_config = &chan->chan_config;
733733
struct scatterlist *sg;
734734
dma_addr_t src_addr, dst_addr;
735-
u32 m2m_hw_period, ccr, ctcr, ctbr;
735+
u32 m2m_hw_period = 0, ccr = 0, ctcr, ctbr;
736736
int i, ret = 0;
737737

738738
if (chan_config->m2m_hw)

0 commit comments

Comments
 (0)