Unverified Commit 5e121a81 authored by Johan Hovold's avatar Johan Hovold Committed by Mark Brown
Browse files

spi: ep93xx: fix error pointer deref after DMA setup failure

The driver falls back to PIO mode if DMA setup fails during probe.

Make sure to the clear the DMA channel pointers on setup failure to
avoid dereferencing an error pointer on later probe errors or driver
unbind.

This issue was flagged by Sashiko when reviewing a devres allocation
conversion patch.

Fixes: e79e7c2d ("spi: ep93xx: add DT support for Cirrus EP93xx")
Link: https://sashiko.dev/#/patchset/20260429091333.165363-1-johan%40kernel.org?part=10


Cc: stable@vger.kernel.org	# 6.12
Cc: Nikita Shubin <nikita.shubin@maquefel.me>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Acked-by: default avatarNikita Shubin <nikita.shubin@maquefel.me>
Link: https://patch.msgid.link/20260512074849.915143-1-johan@kernel.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5d691905
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -582,12 +582,14 @@ static int ep93xx_spi_setup_dma(struct device *dev, struct ep93xx_spi *espi)
	espi->dma_rx = dma_request_chan(dev, "rx");
	if (IS_ERR(espi->dma_rx)) {
		ret = dev_err_probe(dev, PTR_ERR(espi->dma_rx), "rx DMA setup failed");
		espi->dma_rx = NULL;
		goto fail_free_page;
	}

	espi->dma_tx = dma_request_chan(dev, "tx");
	if (IS_ERR(espi->dma_tx)) {
		ret = dev_err_probe(dev, PTR_ERR(espi->dma_tx), "tx DMA setup failed");
		espi->dma_tx = NULL;
		goto fail_release_rx;
	}