mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alain Volmat <alain.volmat@foss.st.com>
To: "Clément Le Goffic" <clement.legoffic@foss.st.com>
Cc: Mark Brown <broonie@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	<linux-spi@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] spi: stm32: fix sram pool free in probe error path
Date: Mon, 30 Jun 2025 13:47:09 +0200	[thread overview]
Message-ID: <20250630114709.GB398774@gnbcxd0016.gnb.st.com> (raw)
In-Reply-To: <20250630-spi-fix-v1-1-2e671c006e15@foss.st.com>

Hi Clément,

On Mon, Jun 30, 2025 at 10:20:13AM +0200, Clément Le Goffic wrote:
> Add a test to check whether the sram_pool is NULL before freeing it.
> 
> Fixes: d17dd2f1d8a1 ("spi: stm32: use STM32 DMA with STM32 MDMA to enhance DDR use")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
> ---
>  drivers/spi/spi-stm32.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> index 3d20f09f1ae7..858470a2cab5 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c
> @@ -2486,7 +2486,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
>  	if (spi->mdma_rx)
>  		dma_release_channel(spi->mdma_rx);
>  err_pool_free:
> -	gen_pool_free(spi->sram_pool, (unsigned long)spi->sram_rx_buf, spi->sram_rx_buf_size);
> +	if (spi->sram_pool)
> +		gen_pool_free(spi->sram_pool, (unsigned long)spi->sram_rx_buf,
> +			      spi->sram_rx_buf_size);
>  err_dma_release:
>  	if (spi->dma_tx)
>  		dma_release_channel(spi->dma_tx);
> 

Looks good to me. Thanks.
Acked-by: Alain Volmat <alain.volmat@foss.st.com>

Regards,
Alain

> ---
> base-commit: 045719b1d0aab98e6abdd7715e8587b997d1cefa
> change-id: 20250630-spi-fix-860416bfb96d
> 
> Best regards,
> -- 
> Clément Le Goffic <clement.legoffic@foss.st.com>
> 

  reply	other threads:[~2025-06-30 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30  8:20 Clément Le Goffic
2025-06-30 11:47 ` Alain Volmat [this message]
2025-07-01 22:15 ` Mark Brown

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=20250630114709.GB398774@gnbcxd0016.gnb.st.com \
    --to=alain.volmat@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=broonie@kernel.org \
    --cc=clement.legoffic@foss.st.com \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    /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

all inboxes | Powered by JetHome®