spi: stm32: fix pointer-to-pointer variables usage
authorAntonio Quartulli <antonio@mandelbit.com>
Mon, 30 Jun 2025 08:12:53 +0000 (10:12 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 30 Jun 2025 14:59:48 +0000 (15:59 +0100)
commitc4f2c05ab02952c9a56067aeb700ded95b183570
tree8ddf16a1ea851c786c34a4c89c373db034c101b8
parentf4d8438e6a402ad40cf4ccb6e2d2417d9ed47821
spi: stm32: fix pointer-to-pointer variables usage

In stm32_spi_prepare_rx_dma_mdma_chaining() both rx_dma_desc
and rx_mdma_desc are passed as pointer-to-pointer arguments.

The goal is to pass back to the caller the value returned
by dmaengine_prep_slave_sg(), when it is not NULL.

However, these variables are wrongly handled as simple pointers
during later assignments and checks.

Fix this behaviour by introducing two pointer variables
which can then be treated accordingly.

Fixes: d17dd2f1d8a1 ("spi: stm32: use STM32 DMA with STM32 MDMA to enhance DDR use")
Addresses-Coverity-ID: 1644715 ("Null pointer dereferences (REVERSE_INULL)")
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Reviewed-by: Clement LE GOFFIC <clement.legoffic@foss.st.com>
Link: https://patch.msgid.link/20250630081253.17294-1-antonio@mandelbit.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-stm32.c