From: "Clément Le Goffic" <legoffic.clement@gmail.com>
To: Amelie Delaunay <amelie.delaunay@foss.st.com>,
Vinod Koul <vkoul@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: dmaengine@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"Clément Le Goffic" <clement.legoffic@foss.st.com>
Subject: Re: [PATCH] dmaengine: stm32-mdma: initialize m2m_hw_period and ccr to fix warnings
Date: Thu, 30 Oct 2025 14:09:38 +0100 [thread overview]
Message-ID: <287da4e3-0a28-42a3-8f59-7e41dde4d20c@gmail.com> (raw)
In-Reply-To: <20251030-mdma_warnings_fix-v1-1-987f67c75794@foss.st.com>
On 10/30/25 13:26, Amelie Delaunay wrote:
> From: Clément Le Goffic <clement.legoffic@foss.st.com>
>
> 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>
> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> ---
> drivers/dma/stm32/stm32-mdma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
> index 080c1c725216..b87d41b234df 100644
> --- a/drivers/dma/stm32/stm32-mdma.c
> +++ b/drivers/dma/stm32/stm32-mdma.c
> @@ -731,7 +731,7 @@ static int stm32_mdma_setup_xfer(struct stm32_mdma_chan *chan,
> struct stm32_mdma_chan_config *chan_config = &chan->chan_config;
> struct scatterlist *sg;
> dma_addr_t src_addr, dst_addr;
> - u32 m2m_hw_period, ccr, ctcr, ctbr;
> + u32 m2m_hw_period = 0, ccr = 0, ctcr, ctbr;
> int i, ret = 0;
>
> if (chan_config->m2m_hw)
>
> ---
> base-commit: 398035178503bf662281bbffb4bebce1460a4bc5
> change-id: 20251030-mdma_warnings_fix-df4b3d1405ed
>
> Best regards,
Hi Amélie,
Thank you for upstreaming this patch.
You can add my reviewed-by tag:
Reviewed-by: Clément Le Goffic <legoffic.clement@gmail.com>
Best regards,
Clément
prev parent reply other threads:[~2025-10-30 13:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 12:26 [PATCH] dmaengine: stm32-mdma: initialize m2m_hw_period and ccr to fix warnings Amelie Delaunay
2025-10-30 13:09 ` Clément Le Goffic [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=287da4e3-0a28-42a3-8f59-7e41dde4d20c@gmail.com \
--to=legoffic.clement@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=amelie.delaunay@foss.st.com \
--cc=clement.legoffic@foss.st.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).