[PATCH] spi: stm32: fix missing pointer assignment in case of dma chaining

Alain Volmat posted 1 patch 1 month, 3 weeks ago
drivers/spi/spi-stm32.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] spi: stm32: fix missing pointer assignment in case of dma chaining
Posted by Alain Volmat 1 month, 3 weeks ago
Commit c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
introduced a regression since dma descriptors generated as part of the
stm32_spi_prepare_rx_dma_mdma_chaining function are not well propagated
to the caller function, leading to mdma-dma chaining being no more
functional.

Fixes: c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
---
 drivers/spi/spi-stm32.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index b99de8c4cc99..33f211e159ef 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1625,6 +1625,9 @@ static int stm32_spi_prepare_rx_dma_mdma_chaining(struct stm32_spi *spi,
 		return -EINVAL;
 	}
 
+	*rx_mdma_desc = _mdma_desc;
+	*rx_dma_desc = _dma_desc;
+
 	return 0;
 }
 

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260224-spi-stm32-chaining-fix-5363946e7f3a

Best regards,
-- 
Alain Volmat <alain.volmat@foss.st.com>
Re: [PATCH] spi: stm32: fix missing pointer assignment in case of dma chaining
Posted by Mark Brown 1 month, 2 weeks ago
On Tue, 24 Feb 2026 16:09:22 +0100, Alain Volmat wrote:
> Commit c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
> introduced a regression since dma descriptors generated as part of the
> stm32_spi_prepare_rx_dma_mdma_chaining function are not well propagated
> to the caller function, leading to mdma-dma chaining being no more
> functional.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: stm32: fix missing pointer assignment in case of dma chaining
      commit: e96493229a6399e902062213c6381162464cdd50

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH] spi: stm32: fix missing pointer assignment in case of dma chaining
Posted by Antonio Quartulli 1 month, 3 weeks ago
Hi,

On 24/02/2026 16:09, Alain Volmat wrote:
> Commit c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
> introduced a regression since dma descriptors generated as part of the
> stm32_spi_prepare_rx_dma_mdma_chaining function are not well propagated
> to the caller function, leading to mdma-dma chaining being no more
> functional.
> 
> Fixes: c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
> Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
> ---
>   drivers/spi/spi-stm32.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> index b99de8c4cc99..33f211e159ef 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c
> @@ -1625,6 +1625,9 @@ static int stm32_spi_prepare_rx_dma_mdma_chaining(struct stm32_spi *spi,
>   		return -EINVAL;
>   	}
>   
> +	*rx_mdma_desc = _mdma_desc;
> +	*rx_dma_desc = _dma_desc;
> +

Thanks for catching this!

Indeed my fix lost the pointer-to-pointer logic, which was needed to 
pass back the computed values.

This patch looks good, but at this point I think you can also remove the 
lines:

	_dma_desc = NULL;

in the error paths above? Setting them to NULL makes no sense as they 
are not going anywhere.

Regards,



-- 
Antonio Quartulli

CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com
Re: [PATCH] spi: stm32: fix missing pointer assignment in case of dma chaining
Posted by Alain Volmat 1 month, 2 weeks ago
Hi,

On Tue, Feb 24, 2026 at 04:25:14PM +0100, Antonio Quartulli wrote:
> Hi,
> 
> On 24/02/2026 16:09, Alain Volmat wrote:
> > Commit c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
> > introduced a regression since dma descriptors generated as part of the
> > stm32_spi_prepare_rx_dma_mdma_chaining function are not well propagated
> > to the caller function, leading to mdma-dma chaining being no more
> > functional.
> > 
> > Fixes: c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
> > Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
> > ---
> >   drivers/spi/spi-stm32.c | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> > index b99de8c4cc99..33f211e159ef 100644
> > --- a/drivers/spi/spi-stm32.c
> > +++ b/drivers/spi/spi-stm32.c
> > @@ -1625,6 +1625,9 @@ static int stm32_spi_prepare_rx_dma_mdma_chaining(struct stm32_spi *spi,
> >   		return -EINVAL;
> >   	}
> > +	*rx_mdma_desc = _mdma_desc;
> > +	*rx_dma_desc = _dma_desc;
> > +
> 
> Thanks for catching this!
> 
> Indeed my fix lost the pointer-to-pointer logic, which was needed to pass
> back the computed values.
> 
> This patch looks good, but at this point I think you can also remove the
> lines:
> 
> 	_dma_desc = NULL;
> 
> in the error paths above? Setting them to NULL makes no sense as they are
> not going anywhere.

I agree that those lines can be removed. However my feeling is that this
is not part of this fix since this is more about removing useless lines.
If this is ok for you I will propose another patch on top of the current
one for that purpose and without the Fixes on it.

Regards,
Alain
Re: [PATCH] spi: stm32: fix missing pointer assignment in case of dma chaining
Posted by Antonio Quartulli 1 month, 2 weeks ago
On 26/02/2026 17:46, Alain Volmat wrote:
> Hi,
> 
> On Tue, Feb 24, 2026 at 04:25:14PM +0100, Antonio Quartulli wrote:
>> Hi,
>>
>> On 24/02/2026 16:09, Alain Volmat wrote:
>>> Commit c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
>>> introduced a regression since dma descriptors generated as part of the
>>> stm32_spi_prepare_rx_dma_mdma_chaining function are not well propagated
>>> to the caller function, leading to mdma-dma chaining being no more
>>> functional.
>>>
>>> Fixes: c4f2c05ab029 ("spi: stm32: fix pointer-to-pointer variables usage")
>>> Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
>>> ---
>>>    drivers/spi/spi-stm32.c | 3 +++
>>>    1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
>>> index b99de8c4cc99..33f211e159ef 100644
>>> --- a/drivers/spi/spi-stm32.c
>>> +++ b/drivers/spi/spi-stm32.c
>>> @@ -1625,6 +1625,9 @@ static int stm32_spi_prepare_rx_dma_mdma_chaining(struct stm32_spi *spi,
>>>    		return -EINVAL;
>>>    	}
>>> +	*rx_mdma_desc = _mdma_desc;
>>> +	*rx_dma_desc = _dma_desc;
>>> +
>>
>> Thanks for catching this!
>>
>> Indeed my fix lost the pointer-to-pointer logic, which was needed to pass
>> back the computed values.
>>
>> This patch looks good, but at this point I think you can also remove the
>> lines:
>>
>> 	_dma_desc = NULL;
>>
>> in the error paths above? Setting them to NULL makes no sense as they are
>> not going anywhere.
> 
> I agree that those lines can be removed. However my feeling is that this
> is not part of this fix since this is more about removing useless lines.
> If this is ok for you I will propose another patch on top of the current
> one for that purpose and without the Fixes on it.

I agree.

This fix gets my

Acked-by: Antonio Quartulli <antonio@mandelbit.com>

However, I'd let Mark (the maintainer) decide.

Regards,


-- 
Antonio Quartulli

CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com