Skip to content

Commit 3d6224e

Browse files
vladimirolteanbroonie
authored andcommitted
spi: spi-fsl-dspi: Avoid NULL pointer in dspi_slave_abort for non-DMA mode
The driver does not create the dspi->dma structure unless operating in DSPI_DMA_MODE, so it makes sense to check for that. Fixes: f4b3239 ("spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver") Signed-off-by: Vladimir Oltean <[email protected]> Tested-by: Michael Walle <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 4f5ee75 commit 3d6224e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/spi/spi-fsl-dspi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,10 @@ static int dspi_slave_abort(struct spi_master *master)
11921192
* Terminate all pending DMA transactions for the SPI working
11931193
* in SLAVE mode.
11941194
*/
1195-
dmaengine_terminate_sync(dspi->dma->chan_rx);
1196-
dmaengine_terminate_sync(dspi->dma->chan_tx);
1195+
if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) {
1196+
dmaengine_terminate_sync(dspi->dma->chan_rx);
1197+
dmaengine_terminate_sync(dspi->dma->chan_tx);
1198+
}
11971199

11981200
/* Clear the internal DSPI RX and TX FIFO buffers */
11991201
regmap_update_bits(dspi->regmap, SPI_MCR,

0 commit comments

Comments
 (0)