mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-06-04 08:34:01 -04:00
spi: sprd: fix error pointer deref after DMA setup failure
The driver falls back to PIO mode if DMA setup fails during probe.
Make sure to check the dma.enabled flag before trying to release the DMA
channels also on late probe errors to avoid dereferencing an error
pointer (or attempting to release a channel a second time).
This issue was flagged by Sashiko when reviewing a devres allocation
conversion patch.
Fixes: 386119bc7b ("spi: sprd: spi: sprd: Add DMA mode support")
Link: https://sashiko.dev/#/patchset/20260505072909.618363-1-johan%40kernel.org?part=10
Cc: stable@vger.kernel.org # 5.1
Cc: Lanqing Liu <lanqing.liu@unisoc.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260512074733.915029-1-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -991,7 +991,8 @@ static int sprd_spi_probe(struct platform_device *pdev)
|
||||
disable_clk:
|
||||
clk_disable_unprepare(ss->clk);
|
||||
release_dma:
|
||||
sprd_spi_dma_release(ss);
|
||||
if (ss->dma.enable)
|
||||
sprd_spi_dma_release(ss);
|
||||
free_controller:
|
||||
spi_controller_put(sctlr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user