* [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()
@ 2025-04-18 11:27 Christophe JAILLET
2025-04-18 12:09 ` Mukesh Kumar Savaliya
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Christophe JAILLET @ 2025-04-18 11:27 UTC (permalink / raw)
To: Mark Brown, Maxime Coquelin, Alexandre Torgue, Patrice Chotard
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-spi,
linux-stm32, linux-arm-kernel
If an error occurs after a successful stm32_ospi_dma_setup() call, some
dma_release_channel() calls are needed to release some resources, as
already done in the remove function.
Fixes: 79b8a705e26c ("spi: stm32: Add OSPI driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only
---
drivers/spi/spi-stm32-ospi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
index 668022098b1e..9ec9823409cc 100644
--- a/drivers/spi/spi-stm32-ospi.c
+++ b/drivers/spi/spi-stm32-ospi.c
@@ -960,6 +960,10 @@ static int stm32_ospi_probe(struct platform_device *pdev)
err_pm_enable:
pm_runtime_force_suspend(ospi->dev);
mutex_destroy(&ospi->lock);
+ if (ospi->dma_chtx)
+ dma_release_channel(ospi->dma_chtx);
+ if (ospi->dma_chrx)
+ dma_release_channel(ospi->dma_chrx);
return ret;
}
--
2.49.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()
2025-04-18 11:27 [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe() Christophe JAILLET
@ 2025-04-18 12:09 ` Mukesh Kumar Savaliya
2025-04-18 12:20 ` Christophe JAILLET
2025-04-22 6:39 ` Patrice CHOTARD
2025-04-23 11:44 ` Mark Brown
2 siblings, 1 reply; 6+ messages in thread
From: Mukesh Kumar Savaliya @ 2025-04-18 12:09 UTC (permalink / raw)
To: Christophe JAILLET, Mark Brown, Maxime Coquelin,
Alexandre Torgue, Patrice Chotard
Cc: linux-kernel, kernel-janitors, linux-spi, linux-stm32, linux-arm-kernel
On 4/18/2025 4:57 PM, Christophe JAILLET wrote:
[...]
> diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
> index 668022098b1e..9ec9823409cc 100644
> --- a/drivers/spi/spi-stm32-ospi.c
> +++ b/drivers/spi/spi-stm32-ospi.c
> @@ -960,6 +960,10 @@ static int stm32_ospi_probe(struct platform_device *pdev)
> err_pm_enable:
> pm_runtime_force_suspend(ospi->dev);
> mutex_destroy(&ospi->lock);
> + if (ospi->dma_chtx)
> + dma_release_channel(ospi->dma_chtx);
why can't you move to devm_dma_request_chan ? No need to cleanup.
> + if (ospi->dma_chrx)
> + dma_release_channel(ospi->dma_chrx);
>
> return ret;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()
2025-04-18 12:09 ` Mukesh Kumar Savaliya
@ 2025-04-18 12:20 ` Christophe JAILLET
2025-04-18 13:16 ` Mukesh Kumar Savaliya
0 siblings, 1 reply; 6+ messages in thread
From: Christophe JAILLET @ 2025-04-18 12:20 UTC (permalink / raw)
To: quic_msavaliy
Cc: alexandre.torgue, broonie, christophe.jaillet, kernel-janitors,
linux-arm-kernel, linux-kernel, linux-spi, linux-stm32,
mcoquelin.stm32, patrice.chotard
Le 18/04/2025 à 14:09, Mukesh Kumar Savaliya a écrit :
>
>
> On 4/18/2025 4:57 PM, Christophe JAILLET wrote:
> [...]
>> diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
>> index 668022098b1e..9ec9823409cc 100644
>> --- a/drivers/spi/spi-stm32-ospi.c
>> +++ b/drivers/spi/spi-stm32-ospi.c
>> @@ -960,6 +960,10 @@ static int stm32_ospi_probe(struct
>> platform_device *pdev)
>> err_pm_enable:
>> pm_runtime_force_suspend(ospi->dev);
>> mutex_destroy(&ospi->lock);
>> + if (ospi->dma_chtx)
>> + dma_release_channel(ospi->dma_chtx);
> why can't you move to devm_dma_request_chan ? No need to cleanup.
Unless I miss something obvious, this function does not exist.
CJ
>> + if (ospi->dma_chrx)
>> + dma_release_channel(ospi->dma_chrx);
>> return ret;
>> }
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()
2025-04-18 12:20 ` Christophe JAILLET
@ 2025-04-18 13:16 ` Mukesh Kumar Savaliya
0 siblings, 0 replies; 6+ messages in thread
From: Mukesh Kumar Savaliya @ 2025-04-18 13:16 UTC (permalink / raw)
To: Christophe JAILLET
Cc: alexandre.torgue, broonie, kernel-janitors, linux-arm-kernel,
linux-kernel, linux-spi, linux-stm32, mcoquelin.stm32,
patrice.chotard
On 4/18/2025 5:50 PM, Christophe JAILLET wrote:
> Le 18/04/2025 à 14:09, Mukesh Kumar Savaliya a écrit :
>>
>>
>> On 4/18/2025 4:57 PM, Christophe JAILLET wrote:
>> [...]
>>> diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
>>> index 668022098b1e..9ec9823409cc 100644
>>> --- a/drivers/spi/spi-stm32-ospi.c
>>> +++ b/drivers/spi/spi-stm32-ospi.c
>>> @@ -960,6 +960,10 @@ static int stm32_ospi_probe(struct
>>> platform_device *pdev)
>>> err_pm_enable:
>>> pm_runtime_force_suspend(ospi->dev);
>>> mutex_destroy(&ospi->lock);
>>> + if (ospi->dma_chtx)
>>> + dma_release_channel(ospi->dma_chtx);
>> why can't you move to devm_dma_request_chan ? No need to cleanup.
>
> Unless I miss something obvious, this function does not exist.
>
> CJ
>
Yes, You are right. Seems the patch is yet not merged.
https://lore.kernel.org/all/20250115160244.1102881-1-csokas.bence@prolan.hu/T/
dma: Add devm_dma_request_chan()
Can ignore it for now.
>>> + if (ospi->dma_chrx)
>>> + dma_release_channel(ospi->dma_chrx);
>>> return ret;
>>> }
>>
>>
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()
2025-04-18 11:27 [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe() Christophe JAILLET
2025-04-18 12:09 ` Mukesh Kumar Savaliya
@ 2025-04-22 6:39 ` Patrice CHOTARD
2025-04-23 11:44 ` Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Patrice CHOTARD @ 2025-04-22 6:39 UTC (permalink / raw)
To: Christophe JAILLET, Mark Brown, Maxime Coquelin, Alexandre Torgue
Cc: linux-kernel, kernel-janitors, linux-spi, linux-stm32, linux-arm-kernel
On 4/18/25 13:27, Christophe JAILLET wrote:
> If an error occurs after a successful stm32_ospi_dma_setup() call, some
> dma_release_channel() calls are needed to release some resources, as
> already done in the remove function.
>
> Fixes: 79b8a705e26c ("spi: stm32: Add OSPI driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested-only
> ---
> drivers/spi/spi-stm32-ospi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
> index 668022098b1e..9ec9823409cc 100644
> --- a/drivers/spi/spi-stm32-ospi.c
> +++ b/drivers/spi/spi-stm32-ospi.c
> @@ -960,6 +960,10 @@ static int stm32_ospi_probe(struct platform_device *pdev)
> err_pm_enable:
> pm_runtime_force_suspend(ospi->dev);
> mutex_destroy(&ospi->lock);
> + if (ospi->dma_chtx)
> + dma_release_channel(ospi->dma_chtx);
> + if (ospi->dma_chrx)
> + dma_release_channel(ospi->dma_chrx);
>
> return ret;
> }
Hi Christophe
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()
2025-04-18 11:27 [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe() Christophe JAILLET
2025-04-18 12:09 ` Mukesh Kumar Savaliya
2025-04-22 6:39 ` Patrice CHOTARD
@ 2025-04-23 11:44 ` Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-04-23 11:44 UTC (permalink / raw)
To: Maxime Coquelin, Alexandre Torgue, Patrice Chotard, Christophe JAILLET
Cc: linux-kernel, kernel-janitors, linux-spi, linux-stm32, linux-arm-kernel
On Fri, 18 Apr 2025 13:27:53 +0200, Christophe JAILLET wrote:
> If an error occurs after a successful stm32_ospi_dma_setup() call, some
> dma_release_channel() calls are needed to release some resources, as
> already done in the remove function.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()
commit: 460b14b0929fa9f658a7e159ef646ce456962ab0
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-04-23 11:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-18 11:27 [PATCH] spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe() Christophe JAILLET
2025-04-18 12:09 ` Mukesh Kumar Savaliya
2025-04-18 12:20 ` Christophe JAILLET
2025-04-18 13:16 ` Mukesh Kumar Savaliya
2025-04-22 6:39 ` Patrice CHOTARD
2025-04-23 11:44 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®