]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: amlogic: spifc-a4: Fix DMA mapping error handling
authorFelix Gu <ustc.gu@gmail.com>
Thu, 5 Mar 2026 17:24:32 +0000 (01:24 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 9 Mar 2026 12:29:28 +0000 (12:29 +0000)
commitb20b437666e1cb26a7c499d1664e8f2a0ac67000
tree72679f44f5a35ada03fdb295408a962b859bbaf7
parent1f318b96cc84d7c2ab792fcc0bfd42a7ca890681
spi: amlogic: spifc-a4: Fix DMA mapping error handling

Fix three bugs in aml_sfc_dma_buffer_setup() error paths:
1. Unnecessary goto: When the first DMA mapping (sfc->daddr) fails,
   nothing needs cleanup. Use direct return instead of goto.
2. Double-unmap bug: When info DMA mapping failed, the code would
   unmap sfc->daddr inline, then fall through to out_map_data which
   would unmap it again, causing a double-unmap.
3. Wrong unmap size: The out_map_info label used datalen instead of
   infolen when unmapping sfc->iaddr, which could lead to incorrect
   DMA sync behavior.

Fixes: 4670db6f32e9 ("spi: amlogic: add driver for Amlogic SPI Flash Controller")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://patch.msgid.link/20260306-spifc-a4-v1-1-f22c9965f64a@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-amlogic-spifc-a4.c