]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mtd: rawnand: lpc32xx_mlc: fail DMA transfers on timeout
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Fri, 3 Jul 2026 07:37:59 +0000 (15:37 +0800)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 3 Jul 2026 13:45:49 +0000 (15:45 +0200)
commitdbf590b662695b16fbf5917ef129697be4410ea9
treef4856251f841e563183d04e8ae1969bd8e428c99
parent9d4af746af8ce27eefc2338b2feaa1e01f28b6c3
mtd: rawnand: lpc32xx_mlc: fail DMA transfers on timeout

lpc32xx_xmit_dma() starts a DMA transfer and waits up to one second
for its completion, but it ignores the wait result and returns success
after unmapping the buffer.

A timed out read can therefore return success with incomplete data, and
a timed out write can continue the NAND operation without proof that the
DMA payload reached the controller.

Terminate the DMA channel on timeout, unmap the scatterlist through the
existing cleanup path, and return -ETIMEDOUT to the NAND read/write
callers. Initialize the shared cleanup-path result before using it for
dmaengine_prep_slave_sg() failures.

Fixes: 70f7cb78ec53 ("mtd: add LPC32xx MLC NAND driver")
Cc: stable@vger.kernel.org
Reviewed-by: Vladimir Zapolskiy <vz@kernel.org>
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/lpc32xx_mlc.c