mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] spi: stm32: fix sram pool free in probe error path
@ 2025-06-30 12:59 Clément Le Goffic
  2025-06-30 13:16 ` Mark Brown
  2025-07-01 22:15 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Clément Le Goffic @ 2025-06-30 12:59 UTC (permalink / raw)
  To: Alain Volmat, Mark Brown, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel,
	Dan Carpenter, Clément Le Goffic

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>
Acked-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
---
Changes in v2:
- Add Alain Volmat's Acked-by.
- Link to v1: https://lore.kernel.org/r/20250630-spi-fix-v1-1-2e671c006e15@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);

---
base-commit: 045719b1d0aab98e6abdd7715e8587b997d1cefa
change-id: 20250630-spi-fix-860416bfb96d

Best regards,
-- 
Clément Le Goffic <clement.legoffic@foss.st.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] spi: stm32: fix sram pool free in probe error path
  2025-06-30 12:59 [PATCH v2] spi: stm32: fix sram pool free in probe error path Clément Le Goffic
@ 2025-06-30 13:16 ` Mark Brown
  2025-07-01 22:15 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-06-30 13:16 UTC (permalink / raw)
  To: Clément Le Goffic
  Cc: Alain Volmat, Maxime Coquelin, Alexandre Torgue, linux-spi,
	linux-stm32, linux-arm-kernel, linux-kernel, Dan Carpenter

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

On Mon, Jun 30, 2025 at 02:59:23PM +0200, Clément Le Goffic wrote:

> Changes in v2:
> - Add Alain Volmat's Acked-by.
> - Link to v1: https://lore.kernel.org/r/20250630-spi-fix-v1-1-2e671c006e15@foss.st.com

There's no need to resend to pick up tags - maintainers will do that as
a matter of course.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] spi: stm32: fix sram pool free in probe error path
  2025-06-30 12:59 [PATCH v2] spi: stm32: fix sram pool free in probe error path Clément Le Goffic
  2025-06-30 13:16 ` Mark Brown
@ 2025-07-01 22:15 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-07-01 22:15 UTC (permalink / raw)
  To: Alain Volmat, Maxime Coquelin, Alexandre Torgue, Clément Le Goffic
  Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel, Dan Carpenter

On Mon, 30 Jun 2025 14:59:23 +0200, Clément Le Goffic wrote:
> Add a test to check whether the sram_pool is NULL before freeing it.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: stm32: fix sram pool free in probe error path
      commit: f4d8438e6a402ad40cf4ccb6e2d2417d9ed47821

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-01 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 12:59 [PATCH v2] spi: stm32: fix sram pool free in probe error path Clément Le Goffic
2025-06-30 13:16 ` Mark Brown
2025-07-01 22:15 ` Mark Brown

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®