Skip to contentSkip to conversation

spi: stm32-ospi: clean up on error in probe()

PATCH In review Dan Carpenter 3 participants 3 messages Jun 11, 2025 – Jun 12, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: stm32-ospi: clean up on error in probe()

If reset_control_acquire() fails, then we can't return directly. We need to do a little clean up first.

Fixes cf2c3eceb757 ("spi: stm32-ospi: Make usage of reset_control_acquire/release() API")
---
 drivers/spi/spi-stm32-ospi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-stm32-ospi.c +4 -2
index db6b1cfc970f..4ab7e86f4bd5 100644
@@ -937,8 +937,10 @@ static int stm32_ospi_probe(struct platform_device *pdev)
 		goto err_pm_enable;
 
 	ret = reset_control_acquire(ospi->rstc);
-	if (ret)
-		return dev_err_probe(dev, ret, "Can not acquire reset %d\n", ret);
+	if (ret) {
+		dev_err_probe(dev, ret, "Can not acquire reset %d\n", ret);
+		goto err_pm_resume;
+	}
 
 	reset_control_assert(ospi->rstc);
 	udelay(2);
Signature · 1 line
2.47.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dan Carpenter

If reset_control_acquire() fails, then we can't return directly. We need to do a little clean up first.

Fixes cf2c3eceb757 ("spi: stm32-ospi: Make usage of reset_control_acquire/release() API")
---
 drivers/spi/spi-stm32-ospi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-stm32-ospi.c +0 -0
index db6b1cfc970f..4ab7e86f4bd5 100644
@@ -937,8 +937,10 @@ static int stm32_ospi_probe(struct platform_device *pdev)
 		goto err_pm_enable;
 

drivers/spi/spi-stm32-ospi.c static int stm32_ospi_probe(struct platform_device *pdev) · line 946

Quoted 10 lines
drivers/spi/spi-stm32-ospi.c +4 -2
 	ret = reset_control_acquire(ospi->rstc);
-	if (ret)
-		return dev_err_probe(dev, ret, "Can not acquire reset %d\n", ret);
+	if (ret) {
+		dev_err_probe(dev, ret, "Can not acquire reset %d\n", ret);
+		goto err_pm_resume;
+	}
 
 	reset_control_assert(ospi->rstc);
 	udelay(2);

Hi Dan

Thanks
Patrice

maintainer
#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines · Dan Carpenter

If reset_control_acquire() fails, then we can't return directly. We need to do a little clean up first.

Applied to

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

Thanks!

[1/1] spi: stm32-ospi: clean up on error in probe()

      commit: 83f066fac3c231e58e9adf3b307e96fee172dfb3

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