public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
* [PATCH] spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()
@ 2026-05-09 17:55 Felix Gu
  2026-05-16  2:27 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Gu @ 2026-05-09 17:55 UTC (permalink / raw)
  To: Mark Brown, Matthias Brugger, AngeloGioacchino Del Regno,
	Chuanhong Guo
  Cc: linux-spi, linux-kernel, linux-arm-kernel, linux-mediatek,
	Felix Gu

When DMA read times out in mtk_snand_read_page_cache(), the original code
erroneously jumped to cleanup label which skips DMA unmapping and ECC
disable, causing a resource leak.

Fixes: 764f1b748164 ("spi: add driver for MTK SPI NAND Flash Interface")
Signed-off-by: Felix Gu <ustc.gu@gmail•com>
---
 drivers/spi/spi-mtk-snfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
index e616e6800e92..6e96e50fedad 100644
--- a/drivers/spi/spi-mtk-snfi.c
+++ b/drivers/spi/spi-mtk-snfi.c
@@ -961,7 +961,7 @@ static int mtk_snand_read_page_cache(struct mtk_snand *snf,
 		    &snf->op_done, usecs_to_jiffies(SNFI_POLL_INTERVAL))) {
 		dev_err(snf->dev, "DMA timed out for reading from cache.\n");
 		ret = -ETIMEDOUT;
-		goto cleanup;
+		goto cleanup2;
 	}
 
 	// Wait for BUS_SEC_CNTR returning expected value

---
base-commit: e98d21c170b01ddef366f023bbfcf6b31509fa83
change-id: 20260509-snfi-c8d170513987

Best regards,
-- 
Felix Gu <ustc.gu@gmail•com>



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

* Re: [PATCH] spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()
  2026-05-09 17:55 [PATCH] spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache() Felix Gu
@ 2026-05-16  2:27 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-05-16  2:27 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Chuanhong Guo,
	Felix Gu
  Cc: linux-spi, linux-kernel, linux-arm-kernel, linux-mediatek

On Sun, 10 May 2026 01:55:37 +0800, Felix Gu wrote:
> spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()

Applied to

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

Thanks!

[1/1] spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()
      https://git.kernel.org/broonie/spi/c/496ba79b9496

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] 2+ messages in thread

end of thread, other threads:[~2026-05-16  4:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09 17:55 [PATCH] spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache() Felix Gu
2026-05-16  2:27 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox