]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()
authorFelix Gu <ustc.gu@gmail.com>
Sat, 9 May 2026 17:55:37 +0000 (01:55 +0800)
committerMark Brown <broonie@kernel.org>
Sat, 16 May 2026 02:27:08 +0000 (11:27 +0900)
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>
Link: https://patch.msgid.link/20260510-snfi-v1-1-bc375cf1af8e@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-mtk-snfi.c

index e616e6800e92fe11e0df40969044b58d30d34b40..6e96e50fedad4704d7c2e1a28dfe865c32cefd29 100644 (file)
@@ -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